mirror of
https://git.zx2c4.com/cgit
synced 2025-08-04 01:54:28 +02:00
Add support for automatic and custom clone urls
This adds support for two new parameters to cgitrc: clone-prefix and repo.clone-url. If clone-prefix is specified, all repos will get a clone url printed in the sidebar; the url is generated by clone-prefix + repo.url. Additionally, each repo can specify repo.clone-url which will override any such auto-generated url. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
dabb34af76
commit
afcdd083da
4 changed files with 31 additions and 0 deletions
17
ui-shared.c
17
ui-shared.c
|
@ -460,6 +460,7 @@ void cgit_print_pageheader(char *title, int show_search)
|
|||
{
|
||||
static const char *default_info = "This is cgit, a fast webinterface for git repositories";
|
||||
int header = 0;
|
||||
char *url;
|
||||
|
||||
html("<table id='layout' summary=''>\n");
|
||||
html("<tr><td id='sidebar'>\n");
|
||||
|
@ -492,6 +493,22 @@ void cgit_print_pageheader(char *title, int show_search)
|
|||
|
||||
for_each_ref(print_archive_ref, &header);
|
||||
|
||||
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");
|
||||
html("<form method='get' action=''>\n");
|
||||
add_hidden_formfields(0, 1, cgit_query_page);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue