author | Lars Hjemli <hjemli@gmail.com> | 2008-12-06 10:37:37 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-12-06 10:37:37 (UTC) |
commit | 3c32fe07717f27fc891b66ccd06057fb810d03ad (patch) (unidiff) | |
tree | 04897b3eac6432c43284e7da79161e47856d078b | |
parent | 9c8be943f72b6f1bda5a31ce401899c3dd734e98 (diff) | |
parent | ab67164d6217fcda5ef3e07aefa3dd6eee6b65a3 (diff) | |
download | cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.zip cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.tar.gz cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.tar.bz2 |
Merge branch 'full-log'
Conflicts:
cgit.c
cgit.h
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.css | 15 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-log.c | 35 | ||||
-rw-r--r-- | ui-refs.c | 3 | ||||
-rw-r--r-- | ui-repolist.c | 2 | ||||
-rw-r--r-- | ui-shared.c | 12 | ||||
-rw-r--r-- | ui-shared.h | 2 | ||||
-rw-r--r-- | ui-tree.c | 2 |
9 files changed, 61 insertions, 13 deletions
@@ -135,48 +135,50 @@ static void querystring_cb(const char *name, const char *value) | |||
135 | cgit_parse_url(value); | 135 | cgit_parse_url(value); |
136 | } else if (!strcmp(name, "qt")) { | 136 | } else if (!strcmp(name, "qt")) { |
137 | ctx.qry.grep = xstrdup(value); | 137 | ctx.qry.grep = xstrdup(value); |
138 | } else if (!strcmp(name, "q")) { | 138 | } else if (!strcmp(name, "q")) { |
139 | ctx.qry.search = xstrdup(value); | 139 | ctx.qry.search = xstrdup(value); |
140 | } else if (!strcmp(name, "h")) { | 140 | } else if (!strcmp(name, "h")) { |
141 | ctx.qry.head = xstrdup(value); | 141 | ctx.qry.head = xstrdup(value); |
142 | ctx.qry.has_symref = 1; | 142 | ctx.qry.has_symref = 1; |
143 | } else if (!strcmp(name, "id")) { | 143 | } else if (!strcmp(name, "id")) { |
144 | ctx.qry.sha1 = xstrdup(value); | 144 | ctx.qry.sha1 = xstrdup(value); |
145 | ctx.qry.has_sha1 = 1; | 145 | ctx.qry.has_sha1 = 1; |
146 | } else if (!strcmp(name, "id2")) { | 146 | } else if (!strcmp(name, "id2")) { |
147 | ctx.qry.sha2 = xstrdup(value); | 147 | ctx.qry.sha2 = xstrdup(value); |
148 | ctx.qry.has_sha1 = 1; | 148 | ctx.qry.has_sha1 = 1; |
149 | } else if (!strcmp(name, "ofs")) { | 149 | } else if (!strcmp(name, "ofs")) { |
150 | ctx.qry.ofs = atoi(value); | 150 | ctx.qry.ofs = atoi(value); |
151 | } else if (!strcmp(name, "path")) { | 151 | } else if (!strcmp(name, "path")) { |
152 | ctx.qry.path = trim_end(value, '/'); | 152 | ctx.qry.path = trim_end(value, '/'); |
153 | } else if (!strcmp(name, "name")) { | 153 | } else if (!strcmp(name, "name")) { |
154 | ctx.qry.name = xstrdup(value); | 154 | ctx.qry.name = xstrdup(value); |
155 | } else if (!strcmp(name, "mimetype")) { | 155 | } else if (!strcmp(name, "mimetype")) { |
156 | ctx.qry.mimetype = xstrdup(value); | 156 | ctx.qry.mimetype = xstrdup(value); |
157 | } else if (!strcmp(name, "s")){ | 157 | } else if (!strcmp(name, "s")){ |
158 | ctx.qry.sort = xstrdup(value); | 158 | ctx.qry.sort = xstrdup(value); |
159 | } else if (!strcmp(name, "showmsg")) { | ||
160 | ctx.qry.showmsg = atoi(value); | ||
159 | } | 161 | } |
160 | } | 162 | } |
161 | 163 | ||
162 | static void prepare_context(struct cgit_context *ctx) | 164 | static void prepare_context(struct cgit_context *ctx) |
163 | { | 165 | { |
164 | memset(ctx, 0, sizeof(ctx)); | 166 | memset(ctx, 0, sizeof(ctx)); |
165 | ctx->cfg.agefile = "info/web/last-modified"; | 167 | ctx->cfg.agefile = "info/web/last-modified"; |
166 | ctx->cfg.nocache = 0; | 168 | ctx->cfg.nocache = 0; |
167 | ctx->cfg.cache_size = 0; | 169 | ctx->cfg.cache_size = 0; |
168 | ctx->cfg.cache_dynamic_ttl = 5; | 170 | ctx->cfg.cache_dynamic_ttl = 5; |
169 | ctx->cfg.cache_max_create_time = 5; | 171 | ctx->cfg.cache_max_create_time = 5; |
170 | ctx->cfg.cache_repo_ttl = 5; | 172 | ctx->cfg.cache_repo_ttl = 5; |
171 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; | 173 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
172 | ctx->cfg.cache_root_ttl = 5; | 174 | ctx->cfg.cache_root_ttl = 5; |
173 | ctx->cfg.cache_static_ttl = -1; | 175 | ctx->cfg.cache_static_ttl = -1; |
174 | ctx->cfg.css = "/cgit.css"; | 176 | ctx->cfg.css = "/cgit.css"; |
175 | ctx->cfg.logo = "/git-logo.png"; | 177 | ctx->cfg.logo = "/git-logo.png"; |
176 | ctx->cfg.local_time = 0; | 178 | ctx->cfg.local_time = 0; |
177 | ctx->cfg.max_repo_count = 50; | 179 | ctx->cfg.max_repo_count = 50; |
178 | ctx->cfg.max_commit_count = 50; | 180 | ctx->cfg.max_commit_count = 50; |
179 | ctx->cfg.max_lock_attempts = 5; | 181 | ctx->cfg.max_lock_attempts = 5; |
180 | ctx->cfg.max_msg_len = 80; | 182 | ctx->cfg.max_msg_len = 80; |
181 | ctx->cfg.max_repodesc_len = 80; | 183 | ctx->cfg.max_repodesc_len = 80; |
182 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | 184 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
@@ -99,71 +99,86 @@ table.tabs td.form form { | |||
99 | 99 | ||
100 | table.tabs td.form input, | 100 | table.tabs td.form input, |
101 | table.tabs td.form select { | 101 | table.tabs td.form select { |
102 | font-size: 90%; | 102 | font-size: 90%; |
103 | } | 103 | } |
104 | 104 | ||
105 | div.content { | 105 | div.content { |
106 | margin: 0px; | 106 | margin: 0px; |
107 | padding: 2em; | 107 | padding: 2em; |
108 | border-top: solid 3px #ccc; | 108 | border-top: solid 3px #ccc; |
109 | border-bottom: solid 3px #ccc; | 109 | border-bottom: solid 3px #ccc; |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | table.list { | 113 | table.list { |
114 | width: 100%; | 114 | width: 100%; |
115 | border: none; | 115 | border: none; |
116 | border-collapse: collapse; | 116 | border-collapse: collapse; |
117 | } | 117 | } |
118 | 118 | ||
119 | table.list tr { | 119 | table.list tr { |
120 | background: white; | 120 | background: white; |
121 | } | 121 | } |
122 | 122 | ||
123 | table.list tr.logheader { | ||
124 | background: #eee; | ||
125 | } | ||
126 | |||
123 | table.list tr:hover { | 127 | table.list tr:hover { |
124 | background: #eee; | 128 | background: #eee; |
125 | } | 129 | } |
126 | 130 | ||
127 | table.list tr.nohover:hover { | 131 | table.list tr.nohover:hover { |
128 | background: white; | 132 | background: white; |
129 | } | 133 | } |
130 | 134 | ||
131 | table.list th { | 135 | table.list th { |
132 | font-weight: bold; | 136 | font-weight: bold; |
133 | /* color: #888; | 137 | /* color: #888; |
134 | border-top: dashed 1px #888; | 138 | border-top: dashed 1px #888; |
135 | border-bottom: dashed 1px #888; | 139 | border-bottom: dashed 1px #888; |
136 | */ | 140 | */ |
137 | padding: 0.1em 0.5em 0.05em 0.5em; | 141 | padding: 0.1em 0.5em 0.05em 0.5em; |
138 | vertical-align: baseline; | 142 | vertical-align: baseline; |
139 | } | 143 | } |
140 | 144 | ||
141 | table.list td { | 145 | table.list td { |
142 | border: none; | 146 | border: none; |
143 | padding: 0.1em 0.5em 0.1em 0.5em; | 147 | padding: 0.1em 0.5em 0.1em 0.5em; |
144 | } | 148 | } |
145 | 149 | ||
150 | table.list td.logsubject { | ||
151 | font-family: monospace; | ||
152 | font-weight: bold; | ||
153 | } | ||
154 | |||
155 | table.list td.logmsg { | ||
156 | font-family: monospace; | ||
157 | white-space: pre; | ||
158 | padding: 1em 0em 2em 0em; | ||
159 | } | ||
160 | |||
146 | table.list td a { | 161 | table.list td a { |
147 | color: black; | 162 | color: black; |
148 | } | 163 | } |
149 | 164 | ||
150 | table.list td a:hover { | 165 | table.list td a:hover { |
151 | color: #00f; | 166 | color: #00f; |
152 | } | 167 | } |
153 | 168 | ||
154 | img { | 169 | img { |
155 | border: none; | 170 | border: none; |
156 | } | 171 | } |
157 | 172 | ||
158 | input#switch-btn { | 173 | input#switch-btn { |
159 | margin: 2px 0px 0px 0px; | 174 | margin: 2px 0px 0px 0px; |
160 | } | 175 | } |
161 | 176 | ||
162 | td#sidebar input.txt { | 177 | td#sidebar input.txt { |
163 | width: 100%; | 178 | width: 100%; |
164 | margin: 2px 0px 0px 0px; | 179 | margin: 2px 0px 0px 0px; |
165 | } | 180 | } |
166 | 181 | ||
167 | table#grid { | 182 | table#grid { |
168 | margin: 0px; | 183 | margin: 0px; |
169 | } | 184 | } |
@@ -102,48 +102,49 @@ struct refinfo { | |||
102 | struct reflist { | 102 | struct reflist { |
103 | struct refinfo **refs; | 103 | struct refinfo **refs; |
104 | int alloc; | 104 | int alloc; |
105 | int count; | 105 | int count; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct cgit_query { | 108 | struct cgit_query { |
109 | int has_symref; | 109 | int has_symref; |
110 | int has_sha1; | 110 | int has_sha1; |
111 | char *raw; | 111 | char *raw; |
112 | char *repo; | 112 | char *repo; |
113 | char *page; | 113 | char *page; |
114 | char *search; | 114 | char *search; |
115 | char *grep; | 115 | char *grep; |
116 | char *head; | 116 | char *head; |
117 | char *sha1; | 117 | char *sha1; |
118 | char *sha2; | 118 | char *sha2; |
119 | char *path; | 119 | char *path; |
120 | char *name; | 120 | char *name; |
121 | char *mimetype; | 121 | char *mimetype; |
122 | char *url; | 122 | char *url; |
123 | int ofs; | 123 | int ofs; |
124 | int nohead; | 124 | int nohead; |
125 | char *sort; | 125 | char *sort; |
126 | int showmsg; | ||
126 | }; | 127 | }; |
127 | 128 | ||
128 | struct cgit_config { | 129 | struct cgit_config { |
129 | char *agefile; | 130 | char *agefile; |
130 | char *cache_root; | 131 | char *cache_root; |
131 | char *clone_prefix; | 132 | char *clone_prefix; |
132 | char *css; | 133 | char *css; |
133 | char *favicon; | 134 | char *favicon; |
134 | char *footer; | 135 | char *footer; |
135 | char *index_header; | 136 | char *index_header; |
136 | char *index_info; | 137 | char *index_info; |
137 | char *logo; | 138 | char *logo; |
138 | char *logo_link; | 139 | char *logo_link; |
139 | char *module_link; | 140 | char *module_link; |
140 | char *repo_group; | 141 | char *repo_group; |
141 | char *robots; | 142 | char *robots; |
142 | char *root_title; | 143 | char *root_title; |
143 | char *root_desc; | 144 | char *root_desc; |
144 | char *root_readme; | 145 | char *root_readme; |
145 | char *script_name; | 146 | char *script_name; |
146 | char *virtual_root; | 147 | char *virtual_root; |
147 | int cache_size; | 148 | int cache_size; |
148 | int cache_dynamic_ttl; | 149 | int cache_dynamic_ttl; |
149 | int cache_max_create_time; | 150 | int cache_max_create_time; |
@@ -14,74 +14,88 @@ int files, add_lines, rem_lines; | |||
14 | 14 | ||
15 | void count_lines(char *line, int size) | 15 | void count_lines(char *line, int size) |
16 | { | 16 | { |
17 | if (size <= 0) | 17 | if (size <= 0) |
18 | return; | 18 | return; |
19 | 19 | ||
20 | if (line[0] == '+') | 20 | if (line[0] == '+') |
21 | add_lines++; | 21 | add_lines++; |
22 | 22 | ||
23 | else if (line[0] == '-') | 23 | else if (line[0] == '-') |
24 | rem_lines++; | 24 | rem_lines++; |
25 | } | 25 | } |
26 | 26 | ||
27 | void inspect_files(struct diff_filepair *pair) | 27 | void inspect_files(struct diff_filepair *pair) |
28 | { | 28 | { |
29 | files++; | 29 | files++; |
30 | if (ctx.repo->enable_log_linecount) | 30 | if (ctx.repo->enable_log_linecount) |
31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); | 31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); |
32 | } | 32 | } |
33 | 33 | ||
34 | void print_commit(struct commit *commit) | 34 | void print_commit(struct commit *commit) |
35 | { | 35 | { |
36 | struct commitinfo *info; | 36 | struct commitinfo *info; |
37 | char *tmp; | 37 | char *tmp; |
38 | int cols = 2; | ||
38 | 39 | ||
39 | info = cgit_parse_commit(commit); | 40 | info = cgit_parse_commit(commit); |
40 | html("<tr><td>"); | 41 | htmlf("<tr%s><td>", |
42 | ctx.qry.showmsg ? " class='logheader'" : ""); | ||
41 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); | 43 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
42 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); | 44 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); |
43 | html_link_open(tmp, NULL, NULL); | 45 | html_link_open(tmp, NULL, NULL); |
44 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); | 46 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
45 | html_link_close(); | 47 | html_link_close(); |
46 | html("</td><td>"); | 48 | htmlf("</td><td%s>", |
49 | ctx.qry.showmsg ? " class='logsubject'" : ""); | ||
47 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 50 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
48 | sha1_to_hex(commit->object.sha1)); | 51 | sha1_to_hex(commit->object.sha1)); |
49 | html("</td><td>"); | 52 | html("</td><td>"); |
50 | html_txt(info->author); | 53 | html_txt(info->author); |
51 | if (ctx.repo->enable_log_filecount) { | 54 | if (ctx.repo->enable_log_filecount) { |
52 | files = 0; | 55 | files = 0; |
53 | add_lines = 0; | 56 | add_lines = 0; |
54 | rem_lines = 0; | 57 | rem_lines = 0; |
55 | cgit_diff_commit(commit, inspect_files); | 58 | cgit_diff_commit(commit, inspect_files); |
56 | html("</td><td>"); | 59 | html("</td><td>"); |
57 | htmlf("%d", files); | 60 | htmlf("%d", files); |
58 | if (ctx.repo->enable_log_linecount) { | 61 | if (ctx.repo->enable_log_linecount) { |
59 | html("</td><td>"); | 62 | html("</td><td>"); |
60 | htmlf("-%d/+%d", rem_lines, add_lines); | 63 | htmlf("-%d/+%d", rem_lines, add_lines); |
61 | } | 64 | } |
62 | } | 65 | } |
63 | html("</td></tr>\n"); | 66 | html("</td></tr>\n"); |
67 | if (ctx.qry.showmsg) { | ||
68 | if (ctx.repo->enable_log_filecount) { | ||
69 | cols++; | ||
70 | if (ctx.repo->enable_log_linecount) | ||
71 | cols++; | ||
72 | } | ||
73 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", | ||
74 | cols); | ||
75 | html_txt(info->msg); | ||
76 | html("</td></tr>\n"); | ||
77 | } | ||
64 | cgit_free_commitinfo(info); | 78 | cgit_free_commitinfo(info); |
65 | } | 79 | } |
66 | 80 | ||
67 | static const char *disambiguate_ref(const char *ref) | 81 | static const char *disambiguate_ref(const char *ref) |
68 | { | 82 | { |
69 | unsigned char sha1[20]; | 83 | unsigned char sha1[20]; |
70 | const char *longref; | 84 | const char *longref; |
71 | 85 | ||
72 | longref = fmt("refs/heads/%s", ref); | 86 | longref = fmt("refs/heads/%s", ref); |
73 | if (get_sha1(longref, sha1) == 0) | 87 | if (get_sha1(longref, sha1) == 0) |
74 | return longref; | 88 | return longref; |
75 | 89 | ||
76 | return ref; | 90 | return ref; |
77 | } | 91 | } |
78 | 92 | ||
79 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, | 93 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, |
80 | char *path, int pager) | 94 | char *path, int pager) |
81 | { | 95 | { |
82 | struct rev_info rev; | 96 | struct rev_info rev; |
83 | struct commit *commit; | 97 | struct commit *commit; |
84 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; | 98 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; |
85 | int argc = 2; | 99 | int argc = 2; |
86 | int i, columns = 3; | 100 | int i, columns = 3; |
87 | 101 | ||
@@ -92,77 +106,84 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
92 | 106 | ||
93 | if (grep && pattern && (!strcmp(grep, "grep") || | 107 | if (grep && pattern && (!strcmp(grep, "grep") || |
94 | !strcmp(grep, "author") || | 108 | !strcmp(grep, "author") || |
95 | !strcmp(grep, "committer"))) | 109 | !strcmp(grep, "committer"))) |
96 | argv[argc++] = fmt("--%s=%s", grep, pattern); | 110 | argv[argc++] = fmt("--%s=%s", grep, pattern); |
97 | 111 | ||
98 | if (path) { | 112 | if (path) { |
99 | argv[argc++] = "--"; | 113 | argv[argc++] = "--"; |
100 | argv[argc++] = path; | 114 | argv[argc++] = path; |
101 | } | 115 | } |
102 | init_revisions(&rev, NULL); | 116 | init_revisions(&rev, NULL); |
103 | rev.abbrev = DEFAULT_ABBREV; | 117 | rev.abbrev = DEFAULT_ABBREV; |
104 | rev.commit_format = CMIT_FMT_DEFAULT; | 118 | rev.commit_format = CMIT_FMT_DEFAULT; |
105 | rev.verbose_header = 1; | 119 | rev.verbose_header = 1; |
106 | rev.show_root_diff = 0; | 120 | rev.show_root_diff = 0; |
107 | setup_revisions(argc, argv, &rev, NULL); | 121 | setup_revisions(argc, argv, &rev, NULL); |
108 | rev.grep_filter.regflags |= REG_ICASE; | 122 | rev.grep_filter.regflags |= REG_ICASE; |
109 | compile_grep_patterns(&rev.grep_filter); | 123 | compile_grep_patterns(&rev.grep_filter); |
110 | prepare_revision_walk(&rev); | 124 | prepare_revision_walk(&rev); |
111 | 125 | ||
112 | if (pager) | 126 | if (pager) |
113 | html("<table class='list nowrap'>"); | 127 | html("<table class='list nowrap'>"); |
114 | 128 | ||
115 | html("<tr class='nohover'><th class='left'>Age</th>" | 129 | html("<tr class='nohover'><th class='left'>Age</th>" |
116 | "<th class='left'>Commit message</th>" | 130 | "<th class='left'>Commit message"); |
117 | "<th class='left'>Author</th>"); | 131 | if (pager) { |
132 | html(" ("); | ||
133 | cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | ||
134 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, | ||
135 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); | ||
136 | html(")"); | ||
137 | } | ||
138 | html("</th><th class='left'>Author</th>"); | ||
118 | if (ctx.repo->enable_log_filecount) { | 139 | if (ctx.repo->enable_log_filecount) { |
119 | html("<th class='left'>Files</th>"); | 140 | html("<th class='left'>Files</th>"); |
120 | columns++; | 141 | columns++; |
121 | if (ctx.repo->enable_log_linecount) { | 142 | if (ctx.repo->enable_log_linecount) { |
122 | html("<th class='left'>Lines</th>"); | 143 | html("<th class='left'>Lines</th>"); |
123 | columns++; | 144 | columns++; |
124 | } | 145 | } |
125 | } | 146 | } |
126 | html("</tr>\n"); | 147 | html("</tr>\n"); |
127 | 148 | ||
128 | if (ofs<0) | 149 | if (ofs<0) |
129 | ofs = 0; | 150 | ofs = 0; |
130 | 151 | ||
131 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { | 152 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { |
132 | free(commit->buffer); | 153 | free(commit->buffer); |
133 | commit->buffer = NULL; | 154 | commit->buffer = NULL; |
134 | free_commit_list(commit->parents); | 155 | free_commit_list(commit->parents); |
135 | commit->parents = NULL; | 156 | commit->parents = NULL; |
136 | } | 157 | } |
137 | 158 | ||
138 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { | 159 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { |
139 | print_commit(commit); | 160 | print_commit(commit); |
140 | free(commit->buffer); | 161 | free(commit->buffer); |
141 | commit->buffer = NULL; | 162 | commit->buffer = NULL; |
142 | free_commit_list(commit->parents); | 163 | free_commit_list(commit->parents); |
143 | commit->parents = NULL; | 164 | commit->parents = NULL; |
144 | } | 165 | } |
145 | if (pager) { | 166 | if (pager) { |
146 | htmlf("</table><div class='pager'>", | 167 | htmlf("</table><div class='pager'>", |
147 | columns); | 168 | columns); |
148 | if (ofs > 0) { | 169 | if (ofs > 0) { |
149 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, | 170 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
150 | ctx.qry.sha1, ctx.qry.path, | 171 | ctx.qry.sha1, ctx.qry.path, |
151 | ofs - cnt, ctx.qry.grep, | 172 | ofs - cnt, ctx.qry.grep, |
152 | ctx.qry.search); | 173 | ctx.qry.search, ctx.qry.showmsg); |
153 | html(" "); | 174 | html(" "); |
154 | } | 175 | } |
155 | if ((commit = get_revision(&rev)) != NULL) { | 176 | if ((commit = get_revision(&rev)) != NULL) { |
156 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, | 177 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
157 | ctx.qry.sha1, ctx.qry.path, | 178 | ctx.qry.sha1, ctx.qry.path, |
158 | ofs + cnt, ctx.qry.grep, | 179 | ofs + cnt, ctx.qry.grep, |
159 | ctx.qry.search); | 180 | ctx.qry.search, ctx.qry.showmsg); |
160 | } | 181 | } |
161 | html("</div>"); | 182 | html("</div>"); |
162 | } else if ((commit = get_revision(&rev)) != NULL) { | 183 | } else if ((commit = get_revision(&rev)) != NULL) { |
163 | html("<tr class='nohover'><td colspan='3'>"); | 184 | html("<tr class='nohover'><td colspan='3'>"); |
164 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, | 185 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, |
165 | NULL, NULL); | 186 | NULL, NULL, ctx.qry.showmsg); |
166 | html("</td></tr>\n"); | 187 | html("</td></tr>\n"); |
167 | } | 188 | } |
168 | } | 189 | } |
@@ -37,49 +37,50 @@ static int cmp_ref_name(const void *a, const void *b) | |||
37 | static int cmp_branch_age(const void *a, const void *b) | 37 | static int cmp_branch_age(const void *a, const void *b) |
38 | { | 38 | { |
39 | struct refinfo *r1 = *(struct refinfo **)a; | 39 | struct refinfo *r1 = *(struct refinfo **)a; |
40 | struct refinfo *r2 = *(struct refinfo **)b; | 40 | struct refinfo *r2 = *(struct refinfo **)b; |
41 | 41 | ||
42 | return cmp_age(r1->commit->committer_date, r2->commit->committer_date); | 42 | return cmp_age(r1->commit->committer_date, r2->commit->committer_date); |
43 | } | 43 | } |
44 | 44 | ||
45 | static int cmp_tag_age(const void *a, const void *b) | 45 | static int cmp_tag_age(const void *a, const void *b) |
46 | { | 46 | { |
47 | struct refinfo *r1 = *(struct refinfo **)a; | 47 | struct refinfo *r1 = *(struct refinfo **)a; |
48 | struct refinfo *r2 = *(struct refinfo **)b; | 48 | struct refinfo *r2 = *(struct refinfo **)b; |
49 | 49 | ||
50 | return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date); | 50 | return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date); |
51 | } | 51 | } |
52 | 52 | ||
53 | static int print_branch(struct refinfo *ref) | 53 | static int print_branch(struct refinfo *ref) |
54 | { | 54 | { |
55 | struct commitinfo *info = ref->commit; | 55 | struct commitinfo *info = ref->commit; |
56 | char *name = (char *)ref->refname; | 56 | char *name = (char *)ref->refname; |
57 | 57 | ||
58 | if (!info) | 58 | if (!info) |
59 | return 1; | 59 | return 1; |
60 | html("<tr><td>"); | 60 | html("<tr><td>"); |
61 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL); | 61 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, |
62 | ctx.qry.showmsg); | ||
62 | html("</td><td>"); | 63 | html("</td><td>"); |
63 | 64 | ||
64 | if (ref->object->type == OBJ_COMMIT) { | 65 | if (ref->object->type == OBJ_COMMIT) { |
65 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); | 66 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); |
66 | html("</td><td>"); | 67 | html("</td><td>"); |
67 | html_txt(info->author); | 68 | html_txt(info->author); |
68 | html("</td><td colspan='2'>"); | 69 | html("</td><td colspan='2'>"); |
69 | cgit_print_age(info->commit->date, -1, NULL); | 70 | cgit_print_age(info->commit->date, -1, NULL); |
70 | } else { | 71 | } else { |
71 | html("</td><td></td><td>"); | 72 | html("</td><td></td><td>"); |
72 | cgit_object_link(ref->object); | 73 | cgit_object_link(ref->object); |
73 | } | 74 | } |
74 | html("</td></tr>\n"); | 75 | html("</td></tr>\n"); |
75 | return 0; | 76 | return 0; |
76 | } | 77 | } |
77 | 78 | ||
78 | static void print_tag_header() | 79 | static void print_tag_header() |
79 | { | 80 | { |
80 | html("<tr class='nohover'><th class='left'>Tag</th>" | 81 | html("<tr class='nohover'><th class='left'>Tag</th>" |
81 | "<th class='left'>Download</th>" | 82 | "<th class='left'>Download</th>" |
82 | "<th class='left'>Author</th>" | 83 | "<th class='left'>Author</th>" |
83 | "<th class='left' colspan='2'>Age</th></tr>\n"); | 84 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
84 | header = 1; | 85 | header = 1; |
85 | } | 86 | } |
diff --git a/ui-repolist.c b/ui-repolist.c index 87196f0..2c13d50 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -236,43 +236,43 @@ void cgit_print_repolist() | |||
236 | (last_group != NULL && ctx.repo->group != NULL && | 236 | (last_group != NULL && ctx.repo->group != NULL && |
237 | strcmp(ctx.repo->group, last_group)))) { | 237 | strcmp(ctx.repo->group, last_group)))) { |
238 | htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", | 238 | htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", |
239 | columns); | 239 | columns); |
240 | html_txt(ctx.repo->group); | 240 | html_txt(ctx.repo->group); |
241 | html("</td></tr>"); | 241 | html("</td></tr>"); |
242 | last_group = ctx.repo->group; | 242 | last_group = ctx.repo->group; |
243 | } | 243 | } |
244 | htmlf("<tr><td class='%s'>", | 244 | htmlf("<tr><td class='%s'>", |
245 | !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); | 245 | !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); |
246 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); | 246 | cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); |
247 | html("</td><td>"); | 247 | html("</td><td>"); |
248 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); | 248 | html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); |
249 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); | 249 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); |
250 | html_link_close(); | 250 | html_link_close(); |
251 | html("</td><td>"); | 251 | html("</td><td>"); |
252 | html_txt(ctx.repo->owner); | 252 | html_txt(ctx.repo->owner); |
253 | html("</td><td>"); | 253 | html("</td><td>"); |
254 | print_modtime(ctx.repo); | 254 | print_modtime(ctx.repo); |
255 | html("</td>"); | 255 | html("</td>"); |
256 | if (ctx.cfg.enable_index_links) { | 256 | if (ctx.cfg.enable_index_links) { |
257 | html("<td>"); | 257 | html("<td>"); |
258 | cgit_summary_link("summary", NULL, "button", NULL); | 258 | cgit_summary_link("summary", NULL, "button", NULL); |
259 | cgit_log_link("log", NULL, "button", NULL, NULL, NULL, | 259 | cgit_log_link("log", NULL, "button", NULL, NULL, NULL, |
260 | 0, NULL, NULL); | 260 | 0, NULL, NULL, ctx.qry.showmsg); |
261 | cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); | 261 | cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); |
262 | html("</td>"); | 262 | html("</td>"); |
263 | } | 263 | } |
264 | html("</tr>\n"); | 264 | html("</tr>\n"); |
265 | } | 265 | } |
266 | html("</table>"); | 266 | html("</table>"); |
267 | if (!hits) | 267 | if (!hits) |
268 | cgit_print_error("No repositories found"); | 268 | cgit_print_error("No repositories found"); |
269 | else if (hits > ctx.cfg.max_repo_count) | 269 | else if (hits > ctx.cfg.max_repo_count) |
270 | print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search); | 270 | print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search); |
271 | cgit_print_docend(); | 271 | cgit_print_docend(); |
272 | } | 272 | } |
273 | 273 | ||
274 | void cgit_print_site_readme() | 274 | void cgit_print_site_readme() |
275 | { | 275 | { |
276 | if (ctx.cfg.root_readme) | 276 | if (ctx.cfg.root_readme) |
277 | html_include(ctx.cfg.root_readme); | 277 | html_include(ctx.cfg.root_readme); |
278 | } | 278 | } |
diff --git a/ui-shared.c b/ui-shared.c index 9319881..95dfeb4 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -260,72 +260,78 @@ static void reporevlink(char *page, char *name, char *title, char *class, | |||
260 | void cgit_summary_link(char *name, char *title, char *class, char *head) | 260 | void cgit_summary_link(char *name, char *title, char *class, char *head) |
261 | { | 261 | { |
262 | reporevlink(NULL, name, title, class, head, NULL, NULL); | 262 | reporevlink(NULL, name, title, class, head, NULL, NULL); |
263 | } | 263 | } |
264 | 264 | ||
265 | void cgit_tag_link(char *name, char *title, char *class, char *head, | 265 | void cgit_tag_link(char *name, char *title, char *class, char *head, |
266 | char *rev) | 266 | char *rev) |
267 | { | 267 | { |
268 | reporevlink("tag", name, title, class, head, rev, NULL); | 268 | reporevlink("tag", name, title, class, head, rev, NULL); |
269 | } | 269 | } |
270 | 270 | ||
271 | void cgit_tree_link(char *name, char *title, char *class, char *head, | 271 | void cgit_tree_link(char *name, char *title, char *class, char *head, |
272 | char *rev, char *path) | 272 | char *rev, char *path) |
273 | { | 273 | { |
274 | reporevlink("tree", name, title, class, head, rev, path); | 274 | reporevlink("tree", name, title, class, head, rev, path); |
275 | } | 275 | } |
276 | 276 | ||
277 | void cgit_plain_link(char *name, char *title, char *class, char *head, | 277 | void cgit_plain_link(char *name, char *title, char *class, char *head, |
278 | char *rev, char *path) | 278 | char *rev, char *path) |
279 | { | 279 | { |
280 | reporevlink("plain", name, title, class, head, rev, path); | 280 | reporevlink("plain", name, title, class, head, rev, path); |
281 | } | 281 | } |
282 | 282 | ||
283 | void cgit_log_link(char *name, char *title, char *class, char *head, | 283 | void cgit_log_link(char *name, char *title, char *class, char *head, |
284 | char *rev, char *path, int ofs, char *grep, char *pattern) | 284 | char *rev, char *path, int ofs, char *grep, char *pattern, |
285 | int showmsg) | ||
285 | { | 286 | { |
286 | char *delim; | 287 | char *delim; |
287 | 288 | ||
288 | delim = repolink(title, class, "log", head, path); | 289 | delim = repolink(title, class, "log", head, path); |
289 | if (rev && strcmp(rev, ctx.qry.head)) { | 290 | if (rev && strcmp(rev, ctx.qry.head)) { |
290 | html(delim); | 291 | html(delim); |
291 | html("id="); | 292 | html("id="); |
292 | html_url_arg(rev); | 293 | html_url_arg(rev); |
293 | delim = "&"; | 294 | delim = "&"; |
294 | } | 295 | } |
295 | if (grep && pattern) { | 296 | if (grep && pattern) { |
296 | html(delim); | 297 | html(delim); |
297 | html("qt="); | 298 | html("qt="); |
298 | html_url_arg(grep); | 299 | html_url_arg(grep); |
299 | delim = "&"; | 300 | delim = "&"; |
300 | html(delim); | 301 | html(delim); |
301 | html("q="); | 302 | html("q="); |
302 | html_url_arg(pattern); | 303 | html_url_arg(pattern); |
303 | } | 304 | } |
304 | if (ofs > 0) { | 305 | if (ofs > 0) { |
305 | html(delim); | 306 | html(delim); |
306 | html("ofs="); | 307 | html("ofs="); |
307 | htmlf("%d", ofs); | 308 | htmlf("%d", ofs); |
309 | delim = "&"; | ||
310 | } | ||
311 | if (showmsg) { | ||
312 | html(delim); | ||
313 | html("showmsg=1"); | ||
308 | } | 314 | } |
309 | html("'>"); | 315 | html("'>"); |
310 | html_txt(name); | 316 | html_txt(name); |
311 | html("</a>"); | 317 | html("</a>"); |
312 | } | 318 | } |
313 | 319 | ||
314 | void cgit_commit_link(char *name, char *title, char *class, char *head, | 320 | void cgit_commit_link(char *name, char *title, char *class, char *head, |
315 | char *rev) | 321 | char *rev) |
316 | { | 322 | { |
317 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { | 323 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { |
318 | name[ctx.cfg.max_msg_len] = '\0'; | 324 | name[ctx.cfg.max_msg_len] = '\0'; |
319 | name[ctx.cfg.max_msg_len - 1] = '.'; | 325 | name[ctx.cfg.max_msg_len - 1] = '.'; |
320 | name[ctx.cfg.max_msg_len - 2] = '.'; | 326 | name[ctx.cfg.max_msg_len - 2] = '.'; |
321 | name[ctx.cfg.max_msg_len - 3] = '.'; | 327 | name[ctx.cfg.max_msg_len - 3] = '.'; |
322 | } | 328 | } |
323 | reporevlink("commit", name, title, class, head, rev, NULL); | 329 | reporevlink("commit", name, title, class, head, rev, NULL); |
324 | } | 330 | } |
325 | 331 | ||
326 | void cgit_refs_link(char *name, char *title, char *class, char *head, | 332 | void cgit_refs_link(char *name, char *title, char *class, char *head, |
327 | char *rev, char *path) | 333 | char *rev, char *path) |
328 | { | 334 | { |
329 | reporevlink("refs", name, title, class, head, rev, path); | 335 | reporevlink("refs", name, title, class, head, rev, path); |
330 | } | 336 | } |
331 | 337 | ||
@@ -549,48 +555,50 @@ int print_archive_ref(const char *refname, const unsigned char *sha1, | |||
549 | html_txt(strlpart(buf, 20)); | 555 | html_txt(strlpart(buf, 20)); |
550 | html_link_close(); | 556 | html_link_close(); |
551 | return 0; | 557 | return 0; |
552 | } | 558 | } |
553 | 559 | ||
554 | void add_hidden_formfields(int incl_head, int incl_search, char *page) | 560 | void add_hidden_formfields(int incl_head, int incl_search, char *page) |
555 | { | 561 | { |
556 | char *url; | 562 | char *url; |
557 | 563 | ||
558 | if (!ctx.cfg.virtual_root) { | 564 | if (!ctx.cfg.virtual_root) { |
559 | url = fmt("%s/%s", ctx.qry.repo, page); | 565 | url = fmt("%s/%s", ctx.qry.repo, page); |
560 | if (ctx.qry.path) | 566 | if (ctx.qry.path) |
561 | url = fmt("%s/%s", url, ctx.qry.path); | 567 | url = fmt("%s/%s", url, ctx.qry.path); |
562 | html_hidden("url", url); | 568 | html_hidden("url", url); |
563 | } | 569 | } |
564 | 570 | ||
565 | if (incl_head && ctx.qry.head && ctx.repo->defbranch && | 571 | if (incl_head && ctx.qry.head && ctx.repo->defbranch && |
566 | strcmp(ctx.qry.head, ctx.repo->defbranch)) | 572 | strcmp(ctx.qry.head, ctx.repo->defbranch)) |
567 | html_hidden("h", ctx.qry.head); | 573 | html_hidden("h", ctx.qry.head); |
568 | 574 | ||
569 | if (ctx.qry.sha1) | 575 | if (ctx.qry.sha1) |
570 | html_hidden("id", ctx.qry.sha1); | 576 | html_hidden("id", ctx.qry.sha1); |
571 | if (ctx.qry.sha2) | 577 | if (ctx.qry.sha2) |
572 | html_hidden("id2", ctx.qry.sha2); | 578 | html_hidden("id2", ctx.qry.sha2); |
579 | if (ctx.qry.showmsg) | ||
580 | html_hidden("showmsg", "1"); | ||
573 | 581 | ||
574 | if (incl_search) { | 582 | if (incl_search) { |
575 | if (ctx.qry.grep) | 583 | if (ctx.qry.grep) |
576 | html_hidden("qt", ctx.qry.grep); | 584 | html_hidden("qt", ctx.qry.grep); |
577 | if (ctx.qry.search) | 585 | if (ctx.qry.search) |
578 | html_hidden("q", ctx.qry.search); | 586 | html_hidden("q", ctx.qry.search); |
579 | } | 587 | } |
580 | } | 588 | } |
581 | 589 | ||
582 | char *hc(struct cgit_cmd *cmd, const char *page) | 590 | char *hc(struct cgit_cmd *cmd, const char *page) |
583 | { | 591 | { |
584 | return (strcmp(cmd->name, page) ? NULL : "active"); | 592 | return (strcmp(cmd->name, page) ? NULL : "active"); |
585 | } | 593 | } |
586 | 594 | ||
587 | void cgit_print_pageheader(struct cgit_context *ctx) | 595 | void cgit_print_pageheader(struct cgit_context *ctx) |
588 | { | 596 | { |
589 | struct cgit_cmd *cmd = cgit_get_cmd(ctx); | 597 | struct cgit_cmd *cmd = cgit_get_cmd(ctx); |
590 | 598 | ||
591 | html("<table id='header'>\n"); | 599 | html("<table id='header'>\n"); |
592 | html("<tr>\n"); | 600 | html("<tr>\n"); |
593 | html("<td class='logo' rowspan='2'><a href='"); | 601 | html("<td class='logo' rowspan='2'><a href='"); |
594 | if (ctx->cfg.logo_link) | 602 | if (ctx->cfg.logo_link) |
595 | html_attr(ctx->cfg.logo_link); | 603 | html_attr(ctx->cfg.logo_link); |
596 | else | 604 | else |
@@ -615,49 +623,49 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
615 | } else | 623 | } else |
616 | html_txt(ctx->cfg.root_title); | 624 | html_txt(ctx->cfg.root_title); |
617 | html("</td></tr>\n"); | 625 | html("</td></tr>\n"); |
618 | 626 | ||
619 | html("<tr><td class='sub'>"); | 627 | html("<tr><td class='sub'>"); |
620 | if (ctx->repo) { | 628 | if (ctx->repo) { |
621 | html_txt(ctx->repo->desc); | 629 | html_txt(ctx->repo->desc); |
622 | html("</td><td class='sub right'>"); | 630 | html("</td><td class='sub right'>"); |
623 | html_txt(ctx->repo->owner); | 631 | html_txt(ctx->repo->owner); |
624 | } else { | 632 | } else { |
625 | if (ctx->cfg.root_desc) | 633 | if (ctx->cfg.root_desc) |
626 | html_txt(ctx->cfg.root_desc); | 634 | html_txt(ctx->cfg.root_desc); |
627 | else if (ctx->cfg.index_info) | 635 | else if (ctx->cfg.index_info) |
628 | html_include(ctx->cfg.index_info); | 636 | html_include(ctx->cfg.index_info); |
629 | } | 637 | } |
630 | html("</td></tr></table>\n"); | 638 | html("</td></tr></table>\n"); |
631 | 639 | ||
632 | html("<table class='tabs'><tr><td>\n"); | 640 | html("<table class='tabs'><tr><td>\n"); |
633 | if (ctx->repo) { | 641 | if (ctx->repo) { |
634 | cgit_summary_link("summary", NULL, hc(cmd, "summary"), | 642 | cgit_summary_link("summary", NULL, hc(cmd, "summary"), |
635 | ctx->qry.head); | 643 | ctx->qry.head); |
636 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, | 644 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, |
637 | ctx->qry.sha1, NULL); | 645 | ctx->qry.sha1, NULL); |
638 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, | 646 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, |
639 | NULL, NULL, 0, NULL, NULL); | 647 | NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); |
640 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, | 648 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, |
641 | ctx->qry.sha1, NULL); | 649 | ctx->qry.sha1, NULL); |
642 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), | 650 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), |
643 | ctx->qry.head, ctx->qry.sha1); | 651 | ctx->qry.head, ctx->qry.sha1); |
644 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, | 652 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, |
645 | ctx->qry.sha1, ctx->qry.sha2, NULL); | 653 | ctx->qry.sha1, ctx->qry.sha2, NULL); |
646 | if (ctx->repo->readme) | 654 | if (ctx->repo->readme) |
647 | reporevlink("about", "about", NULL, | 655 | reporevlink("about", "about", NULL, |
648 | hc(cmd, "about"), ctx->qry.head, NULL, | 656 | hc(cmd, "about"), ctx->qry.head, NULL, |
649 | NULL); | 657 | NULL); |
650 | html("</td><td class='form'>"); | 658 | html("</td><td class='form'>"); |
651 | html("<form class='right' method='get' action='"); | 659 | html("<form class='right' method='get' action='"); |
652 | if (ctx->cfg.virtual_root) | 660 | if (ctx->cfg.virtual_root) |
653 | html_url_path(cgit_fileurl(ctx->qry.repo, "log", | 661 | html_url_path(cgit_fileurl(ctx->qry.repo, "log", |
654 | ctx->qry.path, NULL)); | 662 | ctx->qry.path, NULL)); |
655 | html("'>\n"); | 663 | html("'>\n"); |
656 | add_hidden_formfields(1, 0, "log"); | 664 | add_hidden_formfields(1, 0, "log"); |
657 | html("<select name='qt'>\n"); | 665 | html("<select name='qt'>\n"); |
658 | html_option("grep", "log msg", ctx->qry.grep); | 666 | html_option("grep", "log msg", ctx->qry.grep); |
659 | html_option("author", "author", ctx->qry.grep); | 667 | html_option("author", "author", ctx->qry.grep); |
660 | html_option("committer", "committer", ctx->qry.grep); | 668 | html_option("committer", "committer", ctx->qry.grep); |
661 | html("</select>\n"); | 669 | html("</select>\n"); |
662 | html("<input class='txt' type='text' size='10' name='q' value='"); | 670 | html("<input class='txt' type='text' size='10' name='q' value='"); |
663 | html_attr(ctx->qry.search); | 671 | html_attr(ctx->qry.search); |
diff --git a/ui-shared.h b/ui-shared.h index 3c8a6d0..2ab53ae 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -1,46 +1,46 @@ | |||
1 | #ifndef UI_SHARED_H | 1 | #ifndef UI_SHARED_H |
2 | #define UI_SHARED_H | 2 | #define UI_SHARED_H |
3 | 3 | ||
4 | extern char *cgit_hosturl(); | 4 | extern char *cgit_hosturl(); |
5 | extern char *cgit_repourl(const char *reponame); | 5 | extern char *cgit_repourl(const char *reponame); |
6 | extern char *cgit_fileurl(const char *reponame, const char *pagename, | 6 | extern char *cgit_fileurl(const char *reponame, const char *pagename, |
7 | const char *filename, const char *query); | 7 | const char *filename, const char *query); |
8 | extern char *cgit_pageurl(const char *reponame, const char *pagename, | 8 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
9 | const char *query); | 9 | const char *query); |
10 | 10 | ||
11 | extern void cgit_index_link(char *name, char *title, char *class, | 11 | extern void cgit_index_link(char *name, char *title, char *class, |
12 | char *pattern, int ofs); | 12 | char *pattern, int ofs); |
13 | extern void cgit_summary_link(char *name, char *title, char *class, char *head); | 13 | extern void cgit_summary_link(char *name, char *title, char *class, char *head); |
14 | extern void cgit_tag_link(char *name, char *title, char *class, char *head, | 14 | extern void cgit_tag_link(char *name, char *title, char *class, char *head, |
15 | char *rev); | 15 | char *rev); |
16 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, | 16 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, |
17 | char *rev, char *path); | 17 | char *rev, char *path); |
18 | extern void cgit_plain_link(char *name, char *title, char *class, char *head, | 18 | extern void cgit_plain_link(char *name, char *title, char *class, char *head, |
19 | char *rev, char *path); | 19 | char *rev, char *path); |
20 | extern void cgit_log_link(char *name, char *title, char *class, char *head, | 20 | extern void cgit_log_link(char *name, char *title, char *class, char *head, |
21 | char *rev, char *path, int ofs, char *grep, | 21 | char *rev, char *path, int ofs, char *grep, |
22 | char *pattern); | 22 | char *pattern, int showmsg); |
23 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, | 23 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, |
24 | char *rev); | 24 | char *rev); |
25 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, | 25 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, |
26 | char *rev); | 26 | char *rev); |
27 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, | 27 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, |
28 | char *rev, char *path); | 28 | char *rev, char *path); |
29 | extern void cgit_snapshot_link(char *name, char *title, char *class, | 29 | extern void cgit_snapshot_link(char *name, char *title, char *class, |
30 | char *head, char *rev, char *archivename); | 30 | char *head, char *rev, char *archivename); |
31 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, | 31 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, |
32 | char *new_rev, char *old_rev, char *path); | 32 | char *new_rev, char *old_rev, char *path); |
33 | extern void cgit_object_link(struct object *obj); | 33 | extern void cgit_object_link(struct object *obj); |
34 | 34 | ||
35 | extern void cgit_print_error(char *msg); | 35 | extern void cgit_print_error(char *msg); |
36 | extern void cgit_print_date(time_t secs, char *format, int local_time); | 36 | extern void cgit_print_date(time_t secs, char *format, int local_time); |
37 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); | 37 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); |
38 | extern void cgit_print_http_headers(struct cgit_context *ctx); | 38 | extern void cgit_print_http_headers(struct cgit_context *ctx); |
39 | extern void cgit_print_docstart(struct cgit_context *ctx); | 39 | extern void cgit_print_docstart(struct cgit_context *ctx); |
40 | extern void cgit_print_docend(); | 40 | extern void cgit_print_docend(); |
41 | extern void cgit_print_pageheader(struct cgit_context *ctx); | 41 | extern void cgit_print_pageheader(struct cgit_context *ctx); |
42 | extern void cgit_print_filemode(unsigned short mode); | 42 | extern void cgit_print_filemode(unsigned short mode); |
43 | extern void cgit_print_snapshot_links(const char *repo, const char *head, | 43 | extern void cgit_print_snapshot_links(const char *repo, const char *head, |
44 | const char *hex, int snapshots); | 44 | const char *hex, int snapshots); |
45 | 45 | ||
46 | #endif /* UI_SHARED_H */ | 46 | #endif /* UI_SHARED_H */ |
@@ -85,49 +85,49 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
85 | } | 85 | } |
86 | 86 | ||
87 | html("<tr><td class='ls-mode'>"); | 87 | html("<tr><td class='ls-mode'>"); |
88 | cgit_print_filemode(mode); | 88 | cgit_print_filemode(mode); |
89 | html("</td><td>"); | 89 | html("</td><td>"); |
90 | if (S_ISGITLINK(mode)) { | 90 | if (S_ISGITLINK(mode)) { |
91 | htmlf("<a class='ls-mod' href='"); | 91 | htmlf("<a class='ls-mod' href='"); |
92 | html_attr(fmt(ctx.repo->module_link, | 92 | html_attr(fmt(ctx.repo->module_link, |
93 | name, | 93 | name, |
94 | sha1_to_hex(sha1))); | 94 | sha1_to_hex(sha1))); |
95 | html("'>"); | 95 | html("'>"); |
96 | html_txt(name); | 96 | html_txt(name); |
97 | html("</a>"); | 97 | html("</a>"); |
98 | } else if (S_ISDIR(mode)) { | 98 | } else if (S_ISDIR(mode)) { |
99 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, | 99 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, |
100 | curr_rev, fullpath); | 100 | curr_rev, fullpath); |
101 | } else { | 101 | } else { |
102 | cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, | 102 | cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, |
103 | curr_rev, fullpath); | 103 | curr_rev, fullpath); |
104 | } | 104 | } |
105 | htmlf("</td><td class='ls-size'>%li</td>", size); | 105 | htmlf("</td><td class='ls-size'>%li</td>", size); |
106 | 106 | ||
107 | html("<td>"); | 107 | html("<td>"); |
108 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, | 108 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, |
109 | fullpath, 0, NULL, NULL); | 109 | fullpath, 0, NULL, NULL, ctx.qry.showmsg); |
110 | html("</td></tr>\n"); | 110 | html("</td></tr>\n"); |
111 | free(name); | 111 | free(name); |
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void ls_head() | 115 | static void ls_head() |
116 | { | 116 | { |
117 | html("<table summary='tree listing' class='list'>\n"); | 117 | html("<table summary='tree listing' class='list'>\n"); |
118 | html("<tr class='nohover'>"); | 118 | html("<tr class='nohover'>"); |
119 | html("<th class='left'>Mode</th>"); | 119 | html("<th class='left'>Mode</th>"); |
120 | html("<th class='left'>Name</th>"); | 120 | html("<th class='left'>Name</th>"); |
121 | html("<th class='right'>Size</th>"); | 121 | html("<th class='right'>Size</th>"); |
122 | html("<th/>"); | 122 | html("<th/>"); |
123 | html("</tr>\n"); | 123 | html("</tr>\n"); |
124 | header = 1; | 124 | header = 1; |
125 | } | 125 | } |
126 | 126 | ||
127 | static void ls_tail() | 127 | static void ls_tail() |
128 | { | 128 | { |
129 | if (!header) | 129 | if (!header) |
130 | return; | 130 | return; |
131 | html("</table>\n"); | 131 | html("</table>\n"); |
132 | header = 0; | 132 | header = 0; |
133 | } | 133 | } |