This makes the log searching more explicit, using a dropdown box to specify the commit field to match against.
Unified · Split
| @@ -94,7 +94,7 @@ static void cgit_print_repo_page(struct cacheitem *item) · 93 unmodified lines | ||
| 94 | 94 | switch(cgit_cmd) { |
| 95 | 95 | case CMD_LOG: |
| 96 | 96 | cgit_print_log(cgit_query_sha1, cgit_query_ofs, |
| 97 | − cgit_max_commit_count, cgit_query_search, | |
| 97 | + cgit_max_commit_count, cgit_query_grep, cgit_query_search, | |
| 98 | 98 | cgit_query_path, 1); |
| 99 | 99 | break; |
| 100 | 100 | case CMD_TREE: |
| @@ -144,15 +144,32 @@ td#search form { · 143 unmodified lines | ||
| 144 | 144 | padding: 0px; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | +td#search select { | |
| 148 | + font-size: 9pt; | |
| 149 | + padding: 0px; | |
| 150 | + border: solid 1px #333; | |
| 151 | + color: #333; | |
| 152 | + background-color: #fff; | |
| 153 | +} | |
| 154 | + | |
| 147 | 155 | td#search input { |
| 148 | 156 | font-size: 9pt; |
| 149 | 157 | padding: 0px; |
| 150 | − width: 10em; | |
| 158 | +} | |
| 159 | + | |
| 160 | +td#search input.txt { | |
| 161 | + width: 8em; | |
| 151 | 162 | border: solid 1px #333; |
| 152 | 163 | color: #333; |
| 153 | 164 | background-color: #fff; |
| 154 | 165 | } |
| 155 | 166 | |
| 167 | +td#search input.btn { | |
| 168 | + border: solid 1px #333; | |
| 169 | + color: #333; | |
| 170 | + background-color: #ccc; | |
| 171 | +} | |
| 172 | + | |
| 156 | 173 | div#summary { |
| 157 | 174 | vertical-align: top; |
| 158 | 175 | margin-bottom: 1em; |
| @@ -158,6 +158,7 @@ extern char *cgit_querystring; · 157 unmodified lines | ||
| 158 | 158 | extern char *cgit_query_repo; |
| 159 | 159 | extern char *cgit_query_page; |
| 160 | 160 | extern char *cgit_query_search; |
| 161 | +extern char *cgit_query_grep; | |
| 161 | 162 | extern char *cgit_query_head; |
| 162 | 163 | extern char *cgit_query_sha1; |
| 163 | 164 | extern char *cgit_query_sha2; |
| @@ -260,7 +261,8 @@ extern void cgit_print_tags(int maxcount); · 96 unmodified lines | ||
| 260 | 261 | |
| 261 | 262 | extern void cgit_print_repolist(struct cacheitem *item); |
| 262 | 263 | extern void cgit_print_summary(); |
| 263 | −extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); | |
| 264 | +extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, | |
| 265 | + char *pattern, char *path, int pager); | |
| 264 | 266 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
| 265 | 267 | extern void cgit_print_tree(const char *rev, char *path); |
| 266 | 268 | extern void cgit_print_commit(char *hex); |
| @@ -54,6 +54,7 @@ char *cgit_query_repo = NULL; · 53 unmodified lines | ||
| 54 | 54 | char *cgit_query_page = NULL; |
| 55 | 55 | char *cgit_query_head = NULL; |
| 56 | 56 | char *cgit_query_search = NULL; |
| 57 | +char *cgit_query_grep = NULL; | |
| 57 | 58 | char *cgit_query_sha1 = NULL; |
| 58 | 59 | char *cgit_query_sha2 = NULL; |
| 59 | 60 | char *cgit_query_path = NULL; |
| @@ -232,6 +233,8 @@ void cgit_querystring_cb(const char *name, const char *value) · 172 unmodified lines | ||
| 232 | 233 | cgit_cmd = cgit_get_cmd_index(value); |
| 233 | 234 | } else if (!strcmp(name, "url")) { |
| 234 | 235 | cgit_parse_url(value); |
| 236 | + } else if (!strcmp(name, "qt")) { | |
| 237 | + cgit_query_grep = xstrdup(value); | |
| 235 | 238 | } else if (!strcmp(name, "q")) { |
| 236 | 239 | cgit_query_search = xstrdup(value); |
| 237 | 240 | } else if (!strcmp(name, "h")) { |
| @@ -51,7 +51,7 @@ void print_commit(struct commit *commit) · 50 unmodified lines | ||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | −void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager) | |
| 54 | +void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager) | |
| 55 | 55 | { |
| 56 | 56 | struct rev_info rev; |
| 57 | 57 | struct commit *commit; |
| @@ -62,8 +62,11 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, i · 4 unmodified lines | ||
| 62 | 62 | if (!tip) |
| 63 | 63 | argv[1] = cgit_query_head; |
| 64 | 64 | |
| 65 | − if (grep) | |
| 66 | − argv[argc++] = fmt("--grep=%s", grep); | |
| 65 | + if (grep && pattern && (!strcmp(grep, "grep") || | |
| 66 | + !strcmp(grep, "author") || | |
| 67 | + !strcmp(grep, "committer"))) | |
| 68 | + argv[argc++] = fmt("--%s=%s", grep, pattern); | |
| 69 | + | |
| 67 | 70 | if (path) { |
| 68 | 71 | argv[argc++] = "--"; |
| 69 | 72 | argv[argc++] = path; |
| @@ -417,9 +417,14 @@ void cgit_print_pageheader(char *title, int show_search) · 416 unmodified lines | ||
| 417 | 417 | html_hidden("id", cgit_query_sha1); |
| 418 | 418 | if (cgit_query_sha2) |
| 419 | 419 | html_hidden("id2", cgit_query_sha2); |
| 420 | − html("<input type='text' name='q' value='"); | |
| 420 | + html("<select name='qt'>"); | |
| 421 | + html_option("grep", "log msg", cgit_query_grep); | |
| 422 | + html_option("author", "author", cgit_query_grep); | |
| 423 | + html_option("committer", "committer", cgit_query_grep); | |
| 424 | + html("</select>"); | |
| 425 | + html("<input class='txt' type='text' name='q' value='"); | |
| 421 | 426 | html_attr(cgit_query_search); |
| 422 | − html("'/></form>"); | |
| 427 | + html("'/><input class='btn' type='submit' value='...'/></form>"); | |
| 423 | 428 | } |
| 424 | 429 | html("</td></tr>"); |
| 425 | 430 | html("<tr><td id='content' colspan='2'>"); |
| @@ -236,7 +236,7 @@ void cgit_print_summary() · 235 unmodified lines | ||
| 236 | 236 | html_include(cgit_repo->readme); |
| 237 | 237 | html("</div>"); |
| 238 | 238 | if (cgit_summary_log > 0) |
| 239 | − cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0); | |
| 239 | + cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, NULL, 0); | |
| 240 | 240 | html("<table class='list nowrap'>"); |
| 241 | 241 | if (cgit_summary_log > 0) |
| 242 | 242 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |