summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
-rw-r--r--ui-shared.c20
3 files changed, 16 insertions, 7 deletions
diff --git a/cgit.c b/cgit.c
index 2aef44d..38f0fdd 100644
--- a/cgit.c
+++ b/cgit.c
@@ -4,96 +4,98 @@
4 * 4 *
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
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#include "cache.h" 10#include "cache.h"
11#include "cmd.h" 11#include "cmd.h"
12#include "configfile.h" 12#include "configfile.h"
13#include "html.h" 13#include "html.h"
14#include "ui-shared.h" 14#include "ui-shared.h"
15#include "ui-stats.h" 15#include "ui-stats.h"
16#include "scan-tree.h" 16#include "scan-tree.h"
17 17
18const char *cgit_version = CGIT_VERSION; 18const char *cgit_version = CGIT_VERSION;
19 19
20void config_cb(const char *name, const char *value) 20void config_cb(const char *name, const char *value)
21{ 21{
22 if (!strcmp(name, "root-title")) 22 if (!strcmp(name, "root-title"))
23 ctx.cfg.root_title = xstrdup(value); 23 ctx.cfg.root_title = xstrdup(value);
24 else if (!strcmp(name, "root-desc")) 24 else if (!strcmp(name, "root-desc"))
25 ctx.cfg.root_desc = xstrdup(value); 25 ctx.cfg.root_desc = xstrdup(value);
26 else if (!strcmp(name, "root-readme")) 26 else if (!strcmp(name, "root-readme"))
27 ctx.cfg.root_readme = xstrdup(value); 27 ctx.cfg.root_readme = xstrdup(value);
28 else if (!strcmp(name, "css")) 28 else if (!strcmp(name, "css"))
29 ctx.cfg.css = xstrdup(value); 29 ctx.cfg.css = xstrdup(value);
30 else if (!strcmp(name, "favicon")) 30 else if (!strcmp(name, "favicon"))
31 ctx.cfg.favicon = xstrdup(value); 31 ctx.cfg.favicon = xstrdup(value);
32 else if (!strcmp(name, "footer")) 32 else if (!strcmp(name, "footer"))
33 ctx.cfg.footer = xstrdup(value); 33 ctx.cfg.footer = xstrdup(value);
34 else if (!strcmp(name, "header")) 34 else if (!strcmp(name, "header"))
35 ctx.cfg.header = xstrdup(value); 35 ctx.cfg.header = xstrdup(value);
36 else if (!strcmp(name, "logo")) 36 else if (!strcmp(name, "logo"))
37 ctx.cfg.logo = xstrdup(value); 37 ctx.cfg.logo = xstrdup(value);
38 else if (!strcmp(name, "index-header")) 38 else if (!strcmp(name, "index-header"))
39 ctx.cfg.index_header = xstrdup(value); 39 ctx.cfg.index_header = xstrdup(value);
40 else if (!strcmp(name, "index-info")) 40 else if (!strcmp(name, "index-info"))
41 ctx.cfg.index_info = xstrdup(value); 41 ctx.cfg.index_info = xstrdup(value);
42 else if (!strcmp(name, "logo-link")) 42 else if (!strcmp(name, "logo-link"))
43 ctx.cfg.logo_link = xstrdup(value); 43 ctx.cfg.logo_link = xstrdup(value);
44 else if (!strcmp(name, "module-link")) 44 else if (!strcmp(name, "module-link"))
45 ctx.cfg.module_link = xstrdup(value); 45 ctx.cfg.module_link = xstrdup(value);
46 else if (!strcmp(name, "virtual-root")) { 46 else if (!strcmp(name, "virtual-root")) {
47 ctx.cfg.virtual_root = trim_end(value, '/'); 47 ctx.cfg.virtual_root = trim_end(value, '/');
48 if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) 48 if (!ctx.cfg.virtual_root && (!strcmp(value, "/")))
49 ctx.cfg.virtual_root = ""; 49 ctx.cfg.virtual_root = "";
50 } else if (!strcmp(name, "nocache")) 50 } else if (!strcmp(name, "nocache"))
51 ctx.cfg.nocache = atoi(value); 51 ctx.cfg.nocache = atoi(value);
52 else if (!strcmp(name, "noheader"))
53 ctx.cfg.noheader = atoi(value);
52 else if (!strcmp(name, "snapshots")) 54 else if (!strcmp(name, "snapshots"))
53 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); 55 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
54 else if (!strcmp(name, "enable-index-links")) 56 else if (!strcmp(name, "enable-index-links"))
55 ctx.cfg.enable_index_links = atoi(value); 57 ctx.cfg.enable_index_links = atoi(value);
56 else if (!strcmp(name, "enable-log-filecount")) 58 else if (!strcmp(name, "enable-log-filecount"))
57 ctx.cfg.enable_log_filecount = atoi(value); 59 ctx.cfg.enable_log_filecount = atoi(value);
58 else if (!strcmp(name, "enable-log-linecount")) 60 else if (!strcmp(name, "enable-log-linecount"))
59 ctx.cfg.enable_log_linecount = atoi(value); 61 ctx.cfg.enable_log_linecount = atoi(value);
60 else if (!strcmp(name, "max-stats")) 62 else if (!strcmp(name, "max-stats"))
61 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); 63 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL);
62 else if (!strcmp(name, "cache-size")) 64 else if (!strcmp(name, "cache-size"))
63 ctx.cfg.cache_size = atoi(value); 65 ctx.cfg.cache_size = atoi(value);
64 else if (!strcmp(name, "cache-root")) 66 else if (!strcmp(name, "cache-root"))
65 ctx.cfg.cache_root = xstrdup(value); 67 ctx.cfg.cache_root = xstrdup(value);
66 else if (!strcmp(name, "cache-root-ttl")) 68 else if (!strcmp(name, "cache-root-ttl"))
67 ctx.cfg.cache_root_ttl = atoi(value); 69 ctx.cfg.cache_root_ttl = atoi(value);
68 else if (!strcmp(name, "cache-repo-ttl")) 70 else if (!strcmp(name, "cache-repo-ttl"))
69 ctx.cfg.cache_repo_ttl = atoi(value); 71 ctx.cfg.cache_repo_ttl = atoi(value);
70 else if (!strcmp(name, "cache-static-ttl")) 72 else if (!strcmp(name, "cache-static-ttl"))
71 ctx.cfg.cache_static_ttl = atoi(value); 73 ctx.cfg.cache_static_ttl = atoi(value);
72 else if (!strcmp(name, "cache-dynamic-ttl")) 74 else if (!strcmp(name, "cache-dynamic-ttl"))
73 ctx.cfg.cache_dynamic_ttl = atoi(value); 75 ctx.cfg.cache_dynamic_ttl = atoi(value);
74 else if (!strcmp(name, "embedded")) 76 else if (!strcmp(name, "embedded"))
75 ctx.cfg.embedded = atoi(value); 77 ctx.cfg.embedded = atoi(value);
76 else if (!strcmp(name, "max-message-length")) 78 else if (!strcmp(name, "max-message-length"))
77 ctx.cfg.max_msg_len = atoi(value); 79 ctx.cfg.max_msg_len = atoi(value);
78 else if (!strcmp(name, "max-repodesc-length")) 80 else if (!strcmp(name, "max-repodesc-length"))
79 ctx.cfg.max_repodesc_len = atoi(value); 81 ctx.cfg.max_repodesc_len = atoi(value);
80 else if (!strcmp(name, "max-repo-count")) 82 else if (!strcmp(name, "max-repo-count"))
81 ctx.cfg.max_repo_count = atoi(value); 83 ctx.cfg.max_repo_count = atoi(value);
82 else if (!strcmp(name, "max-commit-count")) 84 else if (!strcmp(name, "max-commit-count"))
83 ctx.cfg.max_commit_count = atoi(value); 85 ctx.cfg.max_commit_count = atoi(value);
84 else if (!strcmp(name, "summary-log")) 86 else if (!strcmp(name, "summary-log"))
85 ctx.cfg.summary_log = atoi(value); 87 ctx.cfg.summary_log = atoi(value);
86 else if (!strcmp(name, "summary-branches")) 88 else if (!strcmp(name, "summary-branches"))
87 ctx.cfg.summary_branches = atoi(value); 89 ctx.cfg.summary_branches = atoi(value);
88 else if (!strcmp(name, "summary-tags")) 90 else if (!strcmp(name, "summary-tags"))
89 ctx.cfg.summary_tags = atoi(value); 91 ctx.cfg.summary_tags = atoi(value);
90 else if (!strcmp(name, "agefile")) 92 else if (!strcmp(name, "agefile"))
91 ctx.cfg.agefile = xstrdup(value); 93 ctx.cfg.agefile = xstrdup(value);
92 else if (!strcmp(name, "renamelimit")) 94 else if (!strcmp(name, "renamelimit"))
93 ctx.cfg.renamelimit = atoi(value); 95 ctx.cfg.renamelimit = atoi(value);
94 else if (!strcmp(name, "robots")) 96 else if (!strcmp(name, "robots"))
95 ctx.cfg.robots = xstrdup(value); 97 ctx.cfg.robots = xstrdup(value);
96 else if (!strcmp(name, "clone-prefix")) 98 else if (!strcmp(name, "clone-prefix"))
97 ctx.cfg.clone_prefix = xstrdup(value); 99 ctx.cfg.clone_prefix = xstrdup(value);
98 else if (!strcmp(name, "local-time")) 100 else if (!strcmp(name, "local-time"))
99 ctx.cfg.local_time = atoi(value); 101 ctx.cfg.local_time = atoi(value);
diff --git a/cgit.h b/cgit.h
index 73d7208..1056231 100644
--- a/cgit.h
+++ b/cgit.h
@@ -127,96 +127,97 @@ struct cgit_query {
127 int nohead; 127 int nohead;
128 char *sort; 128 char *sort;
129 int showmsg; 129 int showmsg;
130}; 130};
131 131
132struct cgit_config { 132struct cgit_config {
133 char *agefile; 133 char *agefile;
134 char *cache_root; 134 char *cache_root;
135 char *clone_prefix; 135 char *clone_prefix;
136 char *css; 136 char *css;
137 char *favicon; 137 char *favicon;
138 char *footer; 138 char *footer;
139 char *header; 139 char *header;
140 char *index_header; 140 char *index_header;
141 char *index_info; 141 char *index_info;
142 char *logo; 142 char *logo;
143 char *logo_link; 143 char *logo_link;
144 char *module_link; 144 char *module_link;
145 char *repo_group; 145 char *repo_group;
146 char *robots; 146 char *robots;
147 char *root_title; 147 char *root_title;
148 char *root_desc; 148 char *root_desc;
149 char *root_readme; 149 char *root_readme;
150 char *script_name; 150 char *script_name;
151 char *virtual_root; 151 char *virtual_root;
152 int cache_size; 152 int cache_size;
153 int cache_dynamic_ttl; 153 int cache_dynamic_ttl;
154 int cache_max_create_time; 154 int cache_max_create_time;
155 int cache_repo_ttl; 155 int cache_repo_ttl;
156 int cache_root_ttl; 156 int cache_root_ttl;
157 int cache_static_ttl; 157 int cache_static_ttl;
158 int enable_index_links; 158 int enable_index_links;
159 int enable_log_filecount; 159 int enable_log_filecount;
160 int enable_log_linecount; 160 int enable_log_linecount;
161 int local_time; 161 int local_time;
162 int max_repo_count; 162 int max_repo_count;
163 int max_commit_count; 163 int max_commit_count;
164 int max_lock_attempts; 164 int max_lock_attempts;
165 int max_msg_len; 165 int max_msg_len;
166 int max_repodesc_len; 166 int max_repodesc_len;
167 int max_stats; 167 int max_stats;
168 int nocache; 168 int nocache;
169 int renamelimit; 169 int renamelimit;
170 int snapshots; 170 int snapshots;
171 int summary_branches; 171 int summary_branches;
172 int summary_log; 172 int summary_log;
173 int summary_tags; 173 int summary_tags;
174 int embedded; 174 int embedded;
175 int noheader;
175}; 176};
176 177
177struct cgit_page { 178struct cgit_page {
178 time_t modified; 179 time_t modified;
179 time_t expires; 180 time_t expires;
180 size_t size; 181 size_t size;
181 char *mimetype; 182 char *mimetype;
182 char *charset; 183 char *charset;
183 char *filename; 184 char *filename;
184 char *title; 185 char *title;
185}; 186};
186 187
187struct cgit_context { 188struct cgit_context {
188 struct cgit_query qry; 189 struct cgit_query qry;
189 struct cgit_config cfg; 190 struct cgit_config cfg;
190 struct cgit_repo *repo; 191 struct cgit_repo *repo;
191 struct cgit_page page; 192 struct cgit_page page;
192}; 193};
193 194
194struct cgit_snapshot_format { 195struct cgit_snapshot_format {
195 const char *suffix; 196 const char *suffix;
196 const char *mimetype; 197 const char *mimetype;
197 write_archive_fn_t write_func; 198 write_archive_fn_t write_func;
198 int bit; 199 int bit;
199}; 200};
200 201
201extern const char *cgit_version; 202extern const char *cgit_version;
202 203
203extern struct cgit_repolist cgit_repolist; 204extern struct cgit_repolist cgit_repolist;
204extern struct cgit_context ctx; 205extern struct cgit_context ctx;
205extern const struct cgit_snapshot_format cgit_snapshot_formats[]; 206extern const struct cgit_snapshot_format cgit_snapshot_formats[];
206 207
207extern struct cgit_repo *cgit_add_repo(const char *url); 208extern struct cgit_repo *cgit_add_repo(const char *url);
208extern struct cgit_repo *cgit_get_repoinfo(const char *url); 209extern struct cgit_repo *cgit_get_repoinfo(const char *url);
209extern void cgit_repo_config_cb(const char *name, const char *value); 210extern void cgit_repo_config_cb(const char *name, const char *value);
210 211
211extern int chk_zero(int result, char *msg); 212extern int chk_zero(int result, char *msg);
212extern int chk_positive(int result, char *msg); 213extern int chk_positive(int result, char *msg);
213extern int chk_non_negative(int result, char *msg); 214extern int chk_non_negative(int result, char *msg);
214 215
215extern char *trim_end(const char *str, char c); 216extern char *trim_end(const char *str, char c);
216extern char *strlpart(char *txt, int maxlen); 217extern char *strlpart(char *txt, int maxlen);
217extern char *strrpart(char *txt, int maxlen); 218extern char *strrpart(char *txt, int maxlen);
218 219
219extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); 220extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
220extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, 221extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
221 int flags, void *cb_data); 222 int flags, void *cb_data);
222 223
diff --git a/ui-shared.c b/ui-shared.c
index f18b2c7..5e03a7a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -566,144 +566,150 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
566 *header = 1; 566 *header = 1;
567 } 567 }
568 url = cgit_pageurl(ctx.qry.repo, "blob", 568 url = cgit_pageurl(ctx.qry.repo, "blob",
569 fmt("id=%s&path=%s", sha1_to_hex(fileid), 569 fmt("id=%s&path=%s", sha1_to_hex(fileid),
570 buf)); 570 buf));
571 html_link_open(url, NULL, "menu"); 571 html_link_open(url, NULL, "menu");
572 html_txt(strlpart(buf, 20)); 572 html_txt(strlpart(buf, 20));
573 html_link_close(); 573 html_link_close();
574 return 0; 574 return 0;
575} 575}
576 576
577void cgit_add_hidden_formfields(int incl_head, int incl_search, char *page) 577void cgit_add_hidden_formfields(int incl_head, int incl_search, char *page)
578{ 578{
579 char *url; 579 char *url;
580 580
581 if (!ctx.cfg.virtual_root) { 581 if (!ctx.cfg.virtual_root) {
582 url = fmt("%s/%s", ctx.qry.repo, page); 582 url = fmt("%s/%s", ctx.qry.repo, page);
583 if (ctx.qry.path) 583 if (ctx.qry.path)
584 url = fmt("%s/%s", url, ctx.qry.path); 584 url = fmt("%s/%s", url, ctx.qry.path);
585 html_hidden("url", url); 585 html_hidden("url", url);
586 } 586 }
587 587
588 if (incl_head && ctx.qry.head && ctx.repo->defbranch && 588 if (incl_head && ctx.qry.head && ctx.repo->defbranch &&
589 strcmp(ctx.qry.head, ctx.repo->defbranch)) 589 strcmp(ctx.qry.head, ctx.repo->defbranch))
590 html_hidden("h", ctx.qry.head); 590 html_hidden("h", ctx.qry.head);
591 591
592 if (ctx.qry.sha1) 592 if (ctx.qry.sha1)
593 html_hidden("id", ctx.qry.sha1); 593 html_hidden("id", ctx.qry.sha1);
594 if (ctx.qry.sha2) 594 if (ctx.qry.sha2)
595 html_hidden("id2", ctx.qry.sha2); 595 html_hidden("id2", ctx.qry.sha2);
596 if (ctx.qry.showmsg) 596 if (ctx.qry.showmsg)
597 html_hidden("showmsg", "1"); 597 html_hidden("showmsg", "1");
598 598
599 if (incl_search) { 599 if (incl_search) {
600 if (ctx.qry.grep) 600 if (ctx.qry.grep)
601 html_hidden("qt", ctx.qry.grep); 601 html_hidden("qt", ctx.qry.grep);
602 if (ctx.qry.search) 602 if (ctx.qry.search)
603 html_hidden("q", ctx.qry.search); 603 html_hidden("q", ctx.qry.search);
604 } 604 }
605} 605}
606 606
607const char *fallback_cmd = "repolist"; 607const char *fallback_cmd = "repolist";
608 608
609char *hc(struct cgit_cmd *cmd, const char *page) 609char *hc(struct cgit_cmd *cmd, const char *page)
610{ 610{
611 return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active"); 611 return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active");
612} 612}
613 613
614void cgit_print_pageheader(struct cgit_context *ctx) 614static void print_header(struct cgit_context *ctx)
615{ 615{
616 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
617
618 if (!cmd && ctx->repo)
619 fallback_cmd = "summary";
620
621 html("<div id='cgit'>");
622 html("<table id='header'>\n"); 616 html("<table id='header'>\n");
623 html("<tr>\n"); 617 html("<tr>\n");
624 html("<td class='logo' rowspan='2'><a href='"); 618 html("<td class='logo' rowspan='2'><a href='");
625 if (ctx->cfg.logo_link) 619 if (ctx->cfg.logo_link)
626 html_attr(ctx->cfg.logo_link); 620 html_attr(ctx->cfg.logo_link);
627 else 621 else
628 html_attr(cgit_rooturl()); 622 html_attr(cgit_rooturl());
629 html("'><img src='"); 623 html("'><img src='");
630 html_attr(ctx->cfg.logo); 624 html_attr(ctx->cfg.logo);
631 html("' alt='cgit logo'/></a></td>\n"); 625 html("' alt='cgit logo'/></a></td>\n");
632 626
633 html("<td class='main'>"); 627 html("<td class='main'>");
634 if (ctx->repo) { 628 if (ctx->repo) {
635 cgit_index_link("index", NULL, NULL, NULL, 0); 629 cgit_index_link("index", NULL, NULL, NULL, 0);
636 html(" : "); 630 html(" : ");
637 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL); 631 cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL);
638 html("</td><td class='form'>"); 632 html("</td><td class='form'>");
639 html("<form method='get' action=''>\n"); 633 html("<form method='get' action=''>\n");
640 cgit_add_hidden_formfields(0, 1, ctx->qry.page); 634 cgit_add_hidden_formfields(0, 1, ctx->qry.page);
641 html("<select name='h' onchange='this.form.submit();'>\n"); 635 html("<select name='h' onchange='this.form.submit();'>\n");
642 for_each_branch_ref(print_branch_option, ctx->qry.head); 636 for_each_branch_ref(print_branch_option, ctx->qry.head);
643 html("</select> "); 637 html("</select> ");
644 html("<input type='submit' name='' value='switch'/>"); 638 html("<input type='submit' name='' value='switch'/>");
645 html("</form>"); 639 html("</form>");
646 } else 640 } else
647 html_txt(ctx->cfg.root_title); 641 html_txt(ctx->cfg.root_title);
648 html("</td></tr>\n"); 642 html("</td></tr>\n");
649 643
650 html("<tr><td class='sub'>"); 644 html("<tr><td class='sub'>");
651 if (ctx->repo) { 645 if (ctx->repo) {
652 html_txt(ctx->repo->desc); 646 html_txt(ctx->repo->desc);
653 html("</td><td class='sub right'>"); 647 html("</td><td class='sub right'>");
654 html_txt(ctx->repo->owner); 648 html_txt(ctx->repo->owner);
655 } else { 649 } else {
656 if (ctx->cfg.root_desc) 650 if (ctx->cfg.root_desc)
657 html_txt(ctx->cfg.root_desc); 651 html_txt(ctx->cfg.root_desc);
658 else if (ctx->cfg.index_info) 652 else if (ctx->cfg.index_info)
659 html_include(ctx->cfg.index_info); 653 html_include(ctx->cfg.index_info);
660 } 654 }
661 html("</td></tr></table>\n"); 655 html("</td></tr></table>\n");
656}
657
658void cgit_print_pageheader(struct cgit_context *ctx)
659{
660 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
661
662 if (!cmd && ctx->repo)
663 fallback_cmd = "summary";
664
665 html("<div id='cgit'>");
666 if (!ctx->cfg.noheader)
667 print_header(ctx);
662 668
663 html("<table class='tabs'><tr><td>\n"); 669 html("<table class='tabs'><tr><td>\n");
664 if (ctx->repo) { 670 if (ctx->repo) {
665 cgit_summary_link("summary", NULL, hc(cmd, "summary"), 671 cgit_summary_link("summary", NULL, hc(cmd, "summary"),
666 ctx->qry.head); 672 ctx->qry.head);
667 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 673 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
668 ctx->qry.sha1, NULL); 674 ctx->qry.sha1, NULL);
669 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 675 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
670 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); 676 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
671 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 677 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
672 ctx->qry.sha1, NULL); 678 ctx->qry.sha1, NULL);
673 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 679 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
674 ctx->qry.head, ctx->qry.sha1); 680 ctx->qry.head, ctx->qry.sha1);
675 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 681 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
676 ctx->qry.sha1, ctx->qry.sha2, NULL); 682 ctx->qry.sha1, ctx->qry.sha2, NULL);
677 if (ctx->repo->max_stats) 683 if (ctx->repo->max_stats)
678 cgit_stats_link("stats", NULL, hc(cmd, "stats"), 684 cgit_stats_link("stats", NULL, hc(cmd, "stats"),
679 ctx->qry.head, NULL); 685 ctx->qry.head, NULL);
680 if (ctx->repo->readme) 686 if (ctx->repo->readme)
681 reporevlink("about", "about", NULL, 687 reporevlink("about", "about", NULL,
682 hc(cmd, "about"), ctx->qry.head, NULL, 688 hc(cmd, "about"), ctx->qry.head, NULL,
683 NULL); 689 NULL);
684 html("</td><td class='form'>"); 690 html("</td><td class='form'>");
685 html("<form class='right' method='get' action='"); 691 html("<form class='right' method='get' action='");
686 if (ctx->cfg.virtual_root) 692 if (ctx->cfg.virtual_root)
687 html_url_path(cgit_fileurl(ctx->qry.repo, "log", 693 html_url_path(cgit_fileurl(ctx->qry.repo, "log",
688 ctx->qry.path, NULL)); 694 ctx->qry.path, NULL));
689 html("'>\n"); 695 html("'>\n");
690 cgit_add_hidden_formfields(1, 0, "log"); 696 cgit_add_hidden_formfields(1, 0, "log");
691 html("<select name='qt'>\n"); 697 html("<select name='qt'>\n");
692 html_option("grep", "log msg", ctx->qry.grep); 698 html_option("grep", "log msg", ctx->qry.grep);
693 html_option("author", "author", ctx->qry.grep); 699 html_option("author", "author", ctx->qry.grep);
694 html_option("committer", "committer", ctx->qry.grep); 700 html_option("committer", "committer", ctx->qry.grep);
695 html("</select>\n"); 701 html("</select>\n");
696 html("<input class='txt' type='text' size='10' name='q' value='"); 702 html("<input class='txt' type='text' size='10' name='q' value='");
697 html_attr(ctx->qry.search); 703 html_attr(ctx->qry.search);
698 html("'/>\n"); 704 html("'/>\n");
699 html("<input type='submit' value='search'/>\n"); 705 html("<input type='submit' value='search'/>\n");
700 html("</form>\n"); 706 html("</form>\n");
701 } else { 707 } else {
702 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); 708 site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0);
703 if (ctx->cfg.root_readme) 709 if (ctx->cfg.root_readme)
704 site_link("about", "about", NULL, hc(cmd, "about"), 710 site_link("about", "about", NULL, hc(cmd, "about"),
705 NULL, 0); 711 NULL, 0);
706 html("</td><td class='form'>"); 712 html("</td><td class='form'>");
707 html("<form method='get' action='"); 713 html("<form method='get' action='");
708 html_attr(cgit_rooturl()); 714 html_attr(cgit_rooturl());
709 html("'>\n"); 715 html("'>\n");