ctx.cfg.robots = xstrdup(value);
else if (!strcmp(name, "clone-prefix"))
ctx.cfg.clone_prefix = xstrdup(value);
+ else if (!strcmp(name, "clone-url"))
+ ctx.cfg.clone_url = xstrdup(value);
else if (!strcmp(name, "local-time"))
ctx.cfg.local_time = atoi(value);
else if (!prefixcmp(name, "mimetype."))
char *agefile;
char *cache_root;
char *clone_prefix;
+ char *clone_url;
char *css;
char *favicon;
char *footer;
setting is only used if `repo.clone-url` is unspecified. Default value:
none.
+clone-url::
+ Space-separated list of clone-url templates. This setting is only
+ used if `repo.clone-url` is unspecified. Default value: none. See
+ also: "MACRO EXPANSION", "FILTER API".
+
commit-filter::
Specifies a command which will be invoked to format commit messages.
The command will get the message on its STDIN, and the STDOUT from the
repo.clone-url::
A list of space-separated urls which can be used to clone this repo.
- Default value: none.
+ Default value: none. See also: "MACRO EXPANSION".
repo.commit-filter::
Override the default commit-filter. Default value: none. See also:
include=/etc/cgitrc.d/$HTTP_HOST
+The following options are expanded during request processing, and support
+the environment variables defined in "FILTER API":
+
+- clone-url
+- repo.clone-url
+
EXAMPLE CGITRC FILE
-------------------
cache-size=1000
-# Specify some default clone prefixes
-clone-prefix=git://example.com ssh://example.com/pub/git http://example.com/git
+# Specify some default clone urls using macro expansion
+clone-url=git://foo.org/$CGIT_REPO_URL git@foo.org:$CGIT_REPO_URL
# Specify the css url
css=/css/cgit.css
ret->about_filter = ctx.cfg.about_filter;
ret->commit_filter = ctx.cfg.commit_filter;
ret->source_filter = ctx.cfg.source_filter;
+ ret->clone_url = ctx.cfg.clone_url;
return ret;
}
summary-log=5
summary-branches=5
summary-tags=5
+clone-url=git://example.org/\$CGIT_REPO_URL.git
repo.url=foo
repo.path=$PWD/trash/repos/foo/.git
run_test 'find commit 5' 'grep -e "commit 5" trash/tmp'
run_test 'find branch master' 'grep -e "master" trash/tmp'
run_test 'no tags' '! grep -e "tags" trash/tmp'
+run_test 'clone-url expanded correctly' '
+ grep -e "git://example.org/foo.git" trash/tmp
+'
run_test 'generate bar summary' 'cgit_url "bar" >trash/tmp'
run_test 'no commit 45' '! grep -e "commit 45" trash/tmp'
run_test 'find commit 50' 'grep -e "commit 50" trash/tmp'
run_test 'find branch master' 'grep -e "master" trash/tmp'
run_test 'no tags' '! grep -e "tags" trash/tmp'
+run_test 'clone-url expanded correctly' '
+ grep -e "git://example.org/bar.git" trash/tmp
+'
tests_done
NULL, NULL, 0, 0);
}
if (ctx.repo->clone_url)
- print_urls(ctx.repo->clone_url, NULL);
+ print_urls(expand_macros(ctx.repo->clone_url), NULL);
else if (ctx.cfg.clone_prefix)
print_urls(ctx.cfg.clone_prefix, ctx.repo->url);
html("</table>");