summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h2
-rw-r--r--cgitrc7
-rw-r--r--shared.c5
-rw-r--r--ui-shared.c17
4 files changed, 31 insertions, 0 deletions
diff --git a/cgit.h b/cgit.h
index ab0efeb..f223dbc 100644
--- a/cgit.h
+++ b/cgit.h
@@ -54,48 +54,49 @@
54 */ 54 */
55#define PAGE_ENCODING "UTF-8" 55#define PAGE_ENCODING "UTF-8"
56 56
57typedef void (*configfn)(const char *name, const char *value); 57typedef void (*configfn)(const char *name, const char *value);
58typedef void (*filepair_fn)(struct diff_filepair *pair); 58typedef void (*filepair_fn)(struct diff_filepair *pair);
59typedef void (*linediff_fn)(char *line, int len); 59typedef void (*linediff_fn)(char *line, int len);
60 60
61struct cacheitem { 61struct cacheitem {
62 char *name; 62 char *name;
63 struct stat st; 63 struct stat st;
64 int ttl; 64 int ttl;
65 int fd; 65 int fd;
66}; 66};
67 67
68struct repoinfo { 68struct repoinfo {
69 char *url; 69 char *url;
70 char *name; 70 char *name;
71 char *path; 71 char *path;
72 char *desc; 72 char *desc;
73 char *owner; 73 char *owner;
74 char *defbranch; 74 char *defbranch;
75 char *group; 75 char *group;
76 char *module_link; 76 char *module_link;
77 char *readme; 77 char *readme;
78 char *clone_url;
78 int snapshots; 79 int snapshots;
79 int enable_log_filecount; 80 int enable_log_filecount;
80 int enable_log_linecount; 81 int enable_log_linecount;
81}; 82};
82 83
83struct repolist { 84struct repolist {
84 int length; 85 int length;
85 int count; 86 int count;
86 struct repoinfo *repos; 87 struct repoinfo *repos;
87}; 88};
88 89
89struct commitinfo { 90struct commitinfo {
90 struct commit *commit; 91 struct commit *commit;
91 char *author; 92 char *author;
92 char *author_email; 93 char *author_email;
93 unsigned long author_date; 94 unsigned long author_date;
94 char *committer; 95 char *committer;
95 char *committer_email; 96 char *committer_email;
96 unsigned long committer_date; 97 unsigned long committer_date;
97 char *subject; 98 char *subject;
98 char *msg; 99 char *msg;
99 char *msg_encoding; 100 char *msg_encoding;
100}; 101};
101 102
@@ -119,48 +120,49 @@ struct reflist {
119 struct refinfo **refs; 120 struct refinfo **refs;
120 int alloc; 121 int alloc;
121 int count; 122 int count;
122}; 123};
123 124
124extern const char *cgit_version; 125extern const char *cgit_version;
125 126
126extern struct repolist cgit_repolist; 127extern struct repolist cgit_repolist;
127extern struct repoinfo *cgit_repo; 128extern struct repoinfo *cgit_repo;
128extern int cgit_cmd; 129extern int cgit_cmd;
129 130
130extern char *cgit_root_title; 131extern char *cgit_root_title;
131extern char *cgit_css; 132extern char *cgit_css;
132extern char *cgit_logo; 133extern char *cgit_logo;
133extern char *cgit_index_header; 134extern char *cgit_index_header;
134extern char *cgit_index_info; 135extern char *cgit_index_info;
135extern char *cgit_logo_link; 136extern char *cgit_logo_link;
136extern char *cgit_module_link; 137extern char *cgit_module_link;
137extern char *cgit_agefile; 138extern char *cgit_agefile;
138extern char *cgit_virtual_root; 139extern char *cgit_virtual_root;
139extern char *cgit_script_name; 140extern char *cgit_script_name;
140extern char *cgit_cache_root; 141extern char *cgit_cache_root;
141extern char *cgit_repo_group; 142extern char *cgit_repo_group;
142extern char *cgit_robots; 143extern char *cgit_robots;
144extern char *cgit_clone_prefix;
143 145
144extern int cgit_nocache; 146extern int cgit_nocache;
145extern int cgit_snapshots; 147extern int cgit_snapshots;
146extern int cgit_enable_index_links; 148extern int cgit_enable_index_links;
147extern int cgit_enable_log_filecount; 149extern int cgit_enable_log_filecount;
148extern int cgit_enable_log_linecount; 150extern int cgit_enable_log_linecount;
149extern int cgit_max_lock_attempts; 151extern int cgit_max_lock_attempts;
150extern int cgit_cache_root_ttl; 152extern int cgit_cache_root_ttl;
151extern int cgit_cache_repo_ttl; 153extern int cgit_cache_repo_ttl;
152extern int cgit_cache_dynamic_ttl; 154extern int cgit_cache_dynamic_ttl;
153extern int cgit_cache_static_ttl; 155extern int cgit_cache_static_ttl;
154extern int cgit_cache_max_create_time; 156extern int cgit_cache_max_create_time;
155extern int cgit_summary_log; 157extern int cgit_summary_log;
156extern int cgit_summary_tags; 158extern int cgit_summary_tags;
157extern int cgit_summary_branches; 159extern int cgit_summary_branches;
158 160
159extern int cgit_max_msg_len; 161extern int cgit_max_msg_len;
160extern int cgit_max_repodesc_len; 162extern int cgit_max_repodesc_len;
161extern int cgit_max_commit_count; 163extern int cgit_max_commit_count;
162 164
163extern int cgit_query_has_symref; 165extern int cgit_query_has_symref;
164extern int cgit_query_has_sha1; 166extern int cgit_query_has_sha1;
165 167
166extern char *cgit_querystring; 168extern char *cgit_querystring;
diff --git a/cgitrc b/cgitrc
index 8c616e0..ce0c01b 100644
--- a/cgitrc
+++ b/cgitrc
@@ -95,48 +95,53 @@
95#index-info= 95#index-info=
96 96
97 97
98## If specified, the file at this path will be included as HTML above 98## If specified, the file at this path will be included as HTML above
99## the repository index 99## the repository index
100#index-header= 100#index-header=
101 101
102 102
103## Link to css file 103## Link to css file
104#css=/cgit/cgit.css 104#css=/cgit/cgit.css
105 105
106 106
107## Link to logo file 107## Link to logo file
108#logo=/cgit/git-logo.png 108#logo=/cgit/git-logo.png
109 109
110 110
111## Url loaded when clicking the logo 111## Url loaded when clicking the logo
112#logo-link=http://www.kernel.org/pub/software/scm/git/docs/ 112#logo-link=http://www.kernel.org/pub/software/scm/git/docs/
113 113
114 114
115## Url loaded when clicking a submodule link 115## Url loaded when clicking a submodule link
116#module-link=./?repo=%s&page=commit&id=%s 116#module-link=./?repo=%s&page=commit&id=%s
117 117
118 118
119## Shared prefix which, when combined with repo url, becomes the url used
120## to clone the repo
121#clone-prefix=
122
123
119## Number of chars shown of repo description (in repolist view) 124## Number of chars shown of repo description (in repolist view)
120#max-repodesc-length=60 125#max-repodesc-length=60
121 126
122 127
123## Number of chars shown of commit subject message (in log view) 128## Number of chars shown of commit subject message (in log view)
124#max-message-length=60 129#max-message-length=60
125 130
126 131
127## Number of commits per page in log view 132## Number of commits per page in log view
128#max-commit-count=50 133#max-commit-count=50
129 134
130 135
131## Root of cached output 136## Root of cached output
132#cache-root=/var/cache/cgit 137#cache-root=/var/cache/cgit
133 138
134 139
135## Include another config-file 140## Include another config-file
136#include=/var/cgit/repolist 141#include=/var/cgit/repolist
137 142
138## 143##
139## Time-To-Live settings: specifies how long (in minutes) different pages 144## Time-To-Live settings: specifies how long (in minutes) different pages
140## should be cached (0 for instant expiration, -1 for immortal pages) 145## should be cached (0 for instant expiration, -1 for immortal pages)
141## 146##
142 147
@@ -146,42 +151,44 @@
146## ttl for repo summary page 151## ttl for repo summary page
147#cache-repo-ttl=5 152#cache-repo-ttl=5
148 153
149## ttl for other dynamic pages 154## ttl for other dynamic pages
150#cache-dynamic-ttl=5 155#cache-dynamic-ttl=5
151 156
152## ttl for static pages (addressed by SHA-1) 157## ttl for static pages (addressed by SHA-1)
153#cache-static-ttl=-1 158#cache-static-ttl=-1
154 159
155 160
156 161
157## Example repository entry. Required values are repo.url and repo.path (each 162## Example repository entry. Required values are repo.url and repo.path (each
158## repository section must start with repo.url). 163## repository section must start with repo.url).
159#repo.url=cgit 164#repo.url=cgit
160#repo.name=cgit 165#repo.name=cgit
161#repo.desc=the caching cgi for git 166#repo.desc=the caching cgi for git
162 #repo.path=/pub/git/cgit ## this is the path to $GIT_DIR 167 #repo.path=/pub/git/cgit ## this is the path to $GIT_DIR
163#repo.owner=Lars Hjemli 168#repo.owner=Lars Hjemli
164 #repo.defbranch=master ## define a default branch 169 #repo.defbranch=master ## define a default branch
165 #repo.snapshots=tar.bz2 ## override a sitewide snapshot-setting 170 #repo.snapshots=tar.bz2 ## override a sitewide snapshot-setting
166 #repo.enable-log-filecount=0 ## override the default filecount setting 171 #repo.enable-log-filecount=0 ## override the default filecount setting
167 #repo.enable-log-linecount=0 ## override the default linecount setting 172 #repo.enable-log-linecount=0 ## override the default linecount setting
168 #repo.module-link=/git/%s/commit/?id=%s ## override the standard module-link 173 #repo.module-link=/git/%s/commit/?id=%s ## override the standard module-link
169 #repo.readme=info/web/readme ## specify a file to include on summary page 174 #repo.readme=info/web/readme ## specify a file to include on summary page
175#repo.clone-url=git://hjemli.net/pub/git/cgit
170 176
171## Additional repositories grouped under "mirrors" 177## Additional repositories grouped under "mirrors"
172#repo.group=mirrors 178#repo.group=mirrors
173 179
174#repo.url=git 180#repo.url=git
175#repo.path=/pub/git/git 181#repo.path=/pub/git/git
182#repo.clone-url=git://hjemli.net/pub/git/git
176# 183#
177#repo.url=linux 184#repo.url=linux
178#repo.path=/pub/git/linux 185#repo.path=/pub/git/linux
179 186
180## A group of private repositories (with a working directory) 187## A group of private repositories (with a working directory)
181#repo.group=private 188#repo.group=private
182 189
183#repo.url=larsh/cgit 190#repo.url=larsh/cgit
184#repo.path=/home/larsh/src/cgit/.git 191#repo.path=/home/larsh/src/cgit/.git
185 192
186#repo.url=larsh/git 193#repo.url=larsh/git
187#repo.path=/home/larsh/src/git/.git 194#repo.path=/home/larsh/src/git/.git
diff --git a/shared.c b/shared.c
index fd8b1e3..2c309f5 100644
--- a/shared.c
+++ b/shared.c
@@ -6,48 +6,49 @@
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10 10
11struct repolist cgit_repolist; 11struct repolist cgit_repolist;
12struct repoinfo *cgit_repo; 12struct repoinfo *cgit_repo;
13int cgit_cmd; 13int cgit_cmd;
14 14
15const char *cgit_version = CGIT_VERSION; 15const char *cgit_version = CGIT_VERSION;
16 16
17char *cgit_root_title = "Git repository browser"; 17char *cgit_root_title = "Git repository browser";
18char *cgit_css = "/cgit.css"; 18char *cgit_css = "/cgit.css";
19char *cgit_logo = "/git-logo.png"; 19char *cgit_logo = "/git-logo.png";
20char *cgit_index_header = NULL; 20char *cgit_index_header = NULL;
21char *cgit_index_info = NULL; 21char *cgit_index_info = NULL;
22char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; 22char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/";
23char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; 23char *cgit_module_link = "./?repo=%s&page=commit&id=%s";
24char *cgit_agefile = "info/web/last-modified"; 24char *cgit_agefile = "info/web/last-modified";
25char *cgit_virtual_root = NULL; 25char *cgit_virtual_root = NULL;
26char *cgit_script_name = CGIT_SCRIPT_NAME; 26char *cgit_script_name = CGIT_SCRIPT_NAME;
27char *cgit_cache_root = CGIT_CACHE_ROOT; 27char *cgit_cache_root = CGIT_CACHE_ROOT;
28char *cgit_repo_group = NULL; 28char *cgit_repo_group = NULL;
29char *cgit_robots = "index, nofollow"; 29char *cgit_robots = "index, nofollow";
30char *cgit_clone_prefix = NULL;
30 31
31int cgit_nocache = 0; 32int cgit_nocache = 0;
32int cgit_snapshots = 0; 33int cgit_snapshots = 0;
33int cgit_enable_index_links = 0; 34int cgit_enable_index_links = 0;
34int cgit_enable_log_filecount = 0; 35int cgit_enable_log_filecount = 0;
35int cgit_enable_log_linecount = 0; 36int cgit_enable_log_linecount = 0;
36int cgit_max_lock_attempts = 5; 37int cgit_max_lock_attempts = 5;
37int cgit_cache_root_ttl = 5; 38int cgit_cache_root_ttl = 5;
38int cgit_cache_repo_ttl = 5; 39int cgit_cache_repo_ttl = 5;
39int cgit_cache_dynamic_ttl = 5; 40int cgit_cache_dynamic_ttl = 5;
40int cgit_cache_static_ttl = -1; 41int cgit_cache_static_ttl = -1;
41int cgit_cache_max_create_time = 5; 42int cgit_cache_max_create_time = 5;
42int cgit_summary_log = 0; 43int cgit_summary_log = 0;
43int cgit_summary_tags = 0; 44int cgit_summary_tags = 0;
44int cgit_summary_branches = 0; 45int cgit_summary_branches = 0;
45int cgit_renamelimit = -1; 46int cgit_renamelimit = -1;
46 47
47int cgit_max_msg_len = 60; 48int cgit_max_msg_len = 60;
48int cgit_max_repodesc_len = 60; 49int cgit_max_repodesc_len = 60;
49int cgit_max_commit_count = 50; 50int cgit_max_commit_count = 50;
50 51
51int cgit_query_has_symref = 0; 52int cgit_query_has_symref = 0;
52int cgit_query_has_sha1 = 0; 53int cgit_query_has_sha1 = 0;
53 54
@@ -179,56 +180,60 @@ void cgit_global_config_cb(const char *name, const char *value)
179 else if (!strcmp(name, "cache-repo-ttl")) 180 else if (!strcmp(name, "cache-repo-ttl"))
180 cgit_cache_repo_ttl = atoi(value); 181 cgit_cache_repo_ttl = atoi(value);
181 else if (!strcmp(name, "cache-static-ttl")) 182 else if (!strcmp(name, "cache-static-ttl"))
182 cgit_cache_static_ttl = atoi(value); 183 cgit_cache_static_ttl = atoi(value);
183 else if (!strcmp(name, "cache-dynamic-ttl")) 184 else if (!strcmp(name, "cache-dynamic-ttl"))
184 cgit_cache_dynamic_ttl = atoi(value); 185 cgit_cache_dynamic_ttl = atoi(value);
185 else if (!strcmp(name, "max-message-length")) 186 else if (!strcmp(name, "max-message-length"))
186 cgit_max_msg_len = atoi(value); 187 cgit_max_msg_len = atoi(value);
187 else if (!strcmp(name, "max-repodesc-length")) 188 else if (!strcmp(name, "max-repodesc-length"))
188 cgit_max_repodesc_len = atoi(value); 189 cgit_max_repodesc_len = atoi(value);
189 else if (!strcmp(name, "max-commit-count")) 190 else if (!strcmp(name, "max-commit-count"))
190 cgit_max_commit_count = atoi(value); 191 cgit_max_commit_count = atoi(value);
191 else if (!strcmp(name, "summary-log")) 192 else if (!strcmp(name, "summary-log"))
192 cgit_summary_log = atoi(value); 193 cgit_summary_log = atoi(value);
193 else if (!strcmp(name, "summary-branches")) 194 else if (!strcmp(name, "summary-branches"))
194 cgit_summary_branches = atoi(value); 195 cgit_summary_branches = atoi(value);
195 else if (!strcmp(name, "summary-tags")) 196 else if (!strcmp(name, "summary-tags"))
196 cgit_summary_tags = atoi(value); 197 cgit_summary_tags = atoi(value);
197 else if (!strcmp(name, "agefile")) 198 else if (!strcmp(name, "agefile"))
198 cgit_agefile = xstrdup(value); 199 cgit_agefile = xstrdup(value);
199 else if (!strcmp(name, "renamelimit")) 200 else if (!strcmp(name, "renamelimit"))
200 cgit_renamelimit = atoi(value); 201 cgit_renamelimit = atoi(value);
201 else if (!strcmp(name, "robots")) 202 else if (!strcmp(name, "robots"))
202 cgit_robots = xstrdup(value); 203 cgit_robots = xstrdup(value);
204 else if (!strcmp(name, "clone-prefix"))
205 cgit_clone_prefix = xstrdup(value);
203 else if (!strcmp(name, "repo.group")) 206 else if (!strcmp(name, "repo.group"))
204 cgit_repo_group = xstrdup(value); 207 cgit_repo_group = xstrdup(value);
205 else if (!strcmp(name, "repo.url")) 208 else if (!strcmp(name, "repo.url"))
206 cgit_repo = add_repo(value); 209 cgit_repo = add_repo(value);
207 else if (!strcmp(name, "repo.name")) 210 else if (!strcmp(name, "repo.name"))
208 cgit_repo->name = xstrdup(value); 211 cgit_repo->name = xstrdup(value);
209 else if (cgit_repo && !strcmp(name, "repo.path")) 212 else if (cgit_repo && !strcmp(name, "repo.path"))
210 cgit_repo->path = trim_end(value, '/'); 213 cgit_repo->path = trim_end(value, '/');
214 else if (cgit_repo && !strcmp(name, "repo.clone-url"))
215 cgit_repo->clone_url = xstrdup(value);
211 else if (cgit_repo && !strcmp(name, "repo.desc")) 216 else if (cgit_repo && !strcmp(name, "repo.desc"))
212 cgit_repo->desc = xstrdup(value); 217 cgit_repo->desc = xstrdup(value);
213 else if (cgit_repo && !strcmp(name, "repo.owner")) 218 else if (cgit_repo && !strcmp(name, "repo.owner"))
214 cgit_repo->owner = xstrdup(value); 219 cgit_repo->owner = xstrdup(value);
215 else if (cgit_repo && !strcmp(name, "repo.defbranch")) 220 else if (cgit_repo && !strcmp(name, "repo.defbranch"))
216 cgit_repo->defbranch = xstrdup(value); 221 cgit_repo->defbranch = xstrdup(value);
217 else if (cgit_repo && !strcmp(name, "repo.snapshots")) 222 else if (cgit_repo && !strcmp(name, "repo.snapshots"))
218 cgit_repo->snapshots = cgit_snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */ 223 cgit_repo->snapshots = cgit_snapshots & cgit_parse_snapshots_mask(value); /* XXX: &? */
219 else if (cgit_repo && !strcmp(name, "repo.enable-log-filecount")) 224 else if (cgit_repo && !strcmp(name, "repo.enable-log-filecount"))
220 cgit_repo->enable_log_filecount = cgit_enable_log_filecount * atoi(value); 225 cgit_repo->enable_log_filecount = cgit_enable_log_filecount * atoi(value);
221 else if (cgit_repo && !strcmp(name, "repo.enable-log-linecount")) 226 else if (cgit_repo && !strcmp(name, "repo.enable-log-linecount"))
222 cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value); 227 cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value);
223 else if (cgit_repo && !strcmp(name, "repo.module-link")) 228 else if (cgit_repo && !strcmp(name, "repo.module-link"))
224 cgit_repo->module_link= xstrdup(value); 229 cgit_repo->module_link= xstrdup(value);
225 else if (cgit_repo && !strcmp(name, "repo.readme") && value != NULL) { 230 else if (cgit_repo && !strcmp(name, "repo.readme") && value != NULL) {
226 if (*value == '/') 231 if (*value == '/')
227 cgit_repo->readme = xstrdup(value); 232 cgit_repo->readme = xstrdup(value);
228 else 233 else
229 cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value)); 234 cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value));
230 } else if (!strcmp(name, "include")) 235 } else if (!strcmp(name, "include"))
231 cgit_read_config(value, cgit_global_config_cb); 236 cgit_read_config(value, cgit_global_config_cb);
232} 237}
233 238
234void cgit_querystring_cb(const char *name, const char *value) 239void cgit_querystring_cb(const char *name, const char *value)
diff --git a/ui-shared.c b/ui-shared.c
index 3e13c86..ece041c 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -439,80 +439,97 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
439 url = fmt("%s/%s", url, cgit_query_path); 439 url = fmt("%s/%s", url, cgit_query_path);
440 html_hidden("url", url); 440 html_hidden("url", url);
441 } 441 }
442 442
443 if (incl_head && strcmp(cgit_query_head, cgit_repo->defbranch)) 443 if (incl_head && strcmp(cgit_query_head, cgit_repo->defbranch))
444 html_hidden("h", cgit_query_head); 444 html_hidden("h", cgit_query_head);
445 445
446 if (cgit_query_sha1) 446 if (cgit_query_sha1)
447 html_hidden("id", cgit_query_sha1); 447 html_hidden("id", cgit_query_sha1);
448 if (cgit_query_sha2) 448 if (cgit_query_sha2)
449 html_hidden("id2", cgit_query_sha2); 449 html_hidden("id2", cgit_query_sha2);
450 450
451 if (incl_search) { 451 if (incl_search) {
452 if (cgit_query_grep) 452 if (cgit_query_grep)
453 html_hidden("qt", cgit_query_grep); 453 html_hidden("qt", cgit_query_grep);
454 if (cgit_query_search) 454 if (cgit_query_search)
455 html_hidden("q", cgit_query_search); 455 html_hidden("q", cgit_query_search);
456 } 456 }
457} 457}
458 458
459void cgit_print_pageheader(char *title, int show_search) 459void cgit_print_pageheader(char *title, int show_search)
460{ 460{
461 static const char *default_info = "This is cgit, a fast webinterface for git repositories"; 461 static const char *default_info = "This is cgit, a fast webinterface for git repositories";
462 int header = 0; 462 int header = 0;
463 char *url;
463 464
464 html("<table id='layout' summary=''>\n"); 465 html("<table id='layout' summary=''>\n");
465 html("<tr><td id='sidebar'>\n"); 466 html("<tr><td id='sidebar'>\n");
466 html("<table class='sidebar' cellspacing='0' summary=''>\n"); 467 html("<table class='sidebar' cellspacing='0' summary=''>\n");
467 html("<tr><td class='sidebar'>\n<a href='"); 468 html("<tr><td class='sidebar'>\n<a href='");
468 html_attr(cgit_rooturl()); 469 html_attr(cgit_rooturl());
469 htmlf("'><img src='%s' alt='cgit'/></a>\n", 470 htmlf("'><img src='%s' alt='cgit'/></a>\n",
470 cgit_logo); 471 cgit_logo);
471 html("</td></tr>\n<tr><td class='sidebar'>\n"); 472 html("</td></tr>\n<tr><td class='sidebar'>\n");
472 if (cgit_query_repo) { 473 if (cgit_query_repo) {
473 html("<h1 class='first'>"); 474 html("<h1 class='first'>");
474 html_txt(strrpart(cgit_repo->name, 20)); 475 html_txt(strrpart(cgit_repo->name, 20));
475 html("</h1>\n"); 476 html("</h1>\n");
476 html_txt(cgit_repo->desc); 477 html_txt(cgit_repo->desc);
477 if (cgit_repo->owner) { 478 if (cgit_repo->owner) {
478 html("<h1>owner</h1>\n"); 479 html("<h1>owner</h1>\n");
479 html_txt(cgit_repo->owner); 480 html_txt(cgit_repo->owner);
480 } 481 }
481 html("<h1>navigate</h1>\n"); 482 html("<h1>navigate</h1>\n");
482 reporevlink(NULL, "summary", NULL, "menu", cgit_query_head, 483 reporevlink(NULL, "summary", NULL, "menu", cgit_query_head,
483 NULL, NULL); 484 NULL, NULL);
484 cgit_log_link("log", NULL, "menu", cgit_query_head, NULL, NULL, 485 cgit_log_link("log", NULL, "menu", cgit_query_head, NULL, NULL,
485 0, NULL, NULL); 486 0, NULL, NULL);
486 cgit_tree_link("tree", NULL, "menu", cgit_query_head, 487 cgit_tree_link("tree", NULL, "menu", cgit_query_head,
487 cgit_query_sha1, NULL); 488 cgit_query_sha1, NULL);
488 cgit_commit_link("commit", NULL, "menu", cgit_query_head, 489 cgit_commit_link("commit", NULL, "menu", cgit_query_head,
489 cgit_query_sha1); 490 cgit_query_sha1);
490 cgit_diff_link("diff", NULL, "menu", cgit_query_head, 491 cgit_diff_link("diff", NULL, "menu", cgit_query_head,
491 cgit_query_sha1, cgit_query_sha2, NULL); 492 cgit_query_sha1, cgit_query_sha2, NULL);
492 493
493 for_each_ref(print_archive_ref, &header); 494 for_each_ref(print_archive_ref, &header);
494 495
496 if (cgit_repo->clone_url || cgit_clone_prefix) {
497 html("<h1>clone</h1>\n");
498 if (cgit_repo->clone_url)
499 url = cgit_repo->clone_url;
500 else
501 url = fmt("%s%s", cgit_clone_prefix,
502 cgit_repo->url);
503 html("<a class='menu' href='");
504 html_attr(url);
505 html("' title='");
506 html_attr(url);
507 html("'>\n");
508 html_txt(strrpart(url, 20));
509 html("</a>\n");
510 }
511
495 html("<h1>branch</h1>\n"); 512 html("<h1>branch</h1>\n");
496 html("<form method='get' action=''>\n"); 513 html("<form method='get' action=''>\n");
497 add_hidden_formfields(0, 1, cgit_query_page); 514 add_hidden_formfields(0, 1, cgit_query_page);
498 // html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>"); 515 // html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
499 html("<select name='h' onchange='this.form.submit();'>\n"); 516 html("<select name='h' onchange='this.form.submit();'>\n");
500 for_each_branch_ref(print_branch_option, cgit_query_head); 517 for_each_branch_ref(print_branch_option, cgit_query_head);
501 html("</select>\n"); 518 html("</select>\n");
502 // html("</td><td>"); 519 // html("</td><td>");
503 html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n"); 520 html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n");
504 // html("</td></tr></table>"); 521 // html("</td></tr></table>");
505 html("</form>\n"); 522 html("</form>\n");
506 523
507 html("<h1>search</h1>\n"); 524 html("<h1>search</h1>\n");
508 html("<form method='get' action='"); 525 html("<form method='get' action='");
509 if (cgit_virtual_root) 526 if (cgit_virtual_root)
510 html_attr(cgit_fileurl(cgit_query_repo, "log", 527 html_attr(cgit_fileurl(cgit_query_repo, "log",
511 cgit_query_path, NULL)); 528 cgit_query_path, NULL));
512 html("'>\n"); 529 html("'>\n");
513 add_hidden_formfields(1, 0, "log"); 530 add_hidden_formfields(1, 0, "log");
514 html("<select name='qt'>\n"); 531 html("<select name='qt'>\n");
515 html_option("grep", "log msg", cgit_query_grep); 532 html_option("grep", "log msg", cgit_query_grep);
516 html_option("author", "author", cgit_query_grep); 533 html_option("author", "author", cgit_query_grep);
517 html_option("committer", "committer", cgit_query_grep); 534 html_option("committer", "committer", cgit_query_grep);
518 html("</select>\n"); 535 html("</select>\n");