-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | cgitrc | 7 | ||||
-rw-r--r-- | shared.c | 5 | ||||
-rw-r--r-- | ui-shared.c | 17 |
4 files changed, 31 insertions, 0 deletions
@@ -77,2 +77,3 @@ struct repoinfo { char *readme; + char *clone_url; int snapshots; @@ -142,2 +143,3 @@ extern char *cgit_repo_group; extern char *cgit_robots; +extern char *cgit_clone_prefix; @@ -118,2 +118,7 @@ +## Shared prefix which, when combined with repo url, becomes the url used +## to clone the repo +#clone-prefix= + + ## Number of chars shown of repo description (in repolist view) @@ -169,2 +174,3 @@ #repo.readme=info/web/readme ## specify a file to include on summary page +#repo.clone-url=git://hjemli.net/pub/git/cgit @@ -175,2 +181,3 @@ #repo.path=/pub/git/git +#repo.clone-url=git://hjemli.net/pub/git/git # @@ -29,2 +29,3 @@ char *cgit_repo_group = NULL; char *cgit_robots = "index, nofollow"; +char *cgit_clone_prefix = NULL; @@ -202,2 +203,4 @@ void cgit_global_config_cb(const char *name, const char *value) cgit_robots = xstrdup(value); + else if (!strcmp(name, "clone-prefix")) + cgit_clone_prefix = xstrdup(value); else if (!strcmp(name, "repo.group")) @@ -210,2 +213,4 @@ void cgit_global_config_cb(const char *name, const char *value) cgit_repo->path = trim_end(value, '/'); + else if (cgit_repo && !strcmp(name, "repo.clone-url")) + cgit_repo->clone_url = xstrdup(value); else if (cgit_repo && !strcmp(name, "repo.desc")) diff --git a/ui-shared.c b/ui-shared.c index 3e13c86..ece041c 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -462,2 +462,3 @@ void cgit_print_pageheader(char *title, int show_search) int header = 0; + char *url; @@ -494,2 +495,18 @@ void cgit_print_pageheader(char *title, int show_search) + if (cgit_repo->clone_url || cgit_clone_prefix) { + html("<h1>clone</h1>\n"); + if (cgit_repo->clone_url) + url = cgit_repo->clone_url; + else + url = fmt("%s%s", cgit_clone_prefix, + cgit_repo->url); + html("<a class='menu' href='"); + html_attr(url); + html("' title='"); + html_attr(url); + html("'>\n"); + html_txt(strrpart(url, 20)); + html("</a>\n"); + } + html("<h1>branch</h1>\n"); |