aboutsummaryrefslogtreecommitdiffstats
path: root/ui-log.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-log.c')
-rw-r--r--ui-log.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/ui-log.c b/ui-log.c
index 3c5130a..c154f69 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -291,7 +291,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
291 struct argv_array rev_argv = ARGV_ARRAY_INIT; 291 struct argv_array rev_argv = ARGV_ARRAY_INIT;
292 int i, columns = commit_graph ? 4 : 3; 292 int i, columns = commit_graph ? 4 : 3;
293 int must_free_tip = 0; 293 int must_free_tip = 0;
294 struct strbuf argbuf = STRBUF_INIT;
295 294
296 /* rev_argv.argv[0] will be ignored by setup_revisions */ 295 /* rev_argv.argv[0] will be ignored by setup_revisions */
297 argv_array_push(&rev_argv, "log_rev_setup"); 296 argv_array_push(&rev_argv, "log_rev_setup");
@@ -305,10 +304,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
305 pattern = xstrdup(pattern); 304 pattern = xstrdup(pattern);
306 if (!strcmp(grep, "grep") || !strcmp(grep, "author") || 305 if (!strcmp(grep, "grep") || !strcmp(grep, "author") ||
307 !strcmp(grep, "committer")) { 306 !strcmp(grep, "committer")) {
308 strbuf_addf(&argbuf, "--%s=%s", grep, pattern); 307 argv_array_pushf(&rev_argv, "--%s=%s", grep, pattern);
309 argv_array_push(&rev_argv, argbuf.buf); 308 } else if (!strcmp(grep, "range")) {
310 }
311 if (!strcmp(grep, "range")) {
312 char *arg; 309 char *arg;
313 /* Split the pattern at whitespace and add each token 310 /* Split the pattern at whitespace and add each token
314 * as a revision expression. Do not accept other 311 * as a revision expression. Do not accept other
@@ -327,25 +324,19 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
327 } 324 }
328 } 325 }
329 if (commit_graph) { 326 if (commit_graph) {
330 static const char *graph_arg = "--graph"; 327 argv_array_push(&rev_argv, "--graph");
331 static const char *color_arg = "--color"; 328 argv_array_push(&rev_argv, "--color");
332 argv_array_push(&rev_argv, graph_arg);
333 argv_array_push(&rev_argv, color_arg);
334 graph_set_column_colors(column_colors_html, 329 graph_set_column_colors(column_colors_html,
335 COLUMN_COLORS_HTML_MAX); 330 COLUMN_COLORS_HTML_MAX);
336 } 331 }
337 332
338 if (commit_sort == 1) { 333 if (commit_sort == 1)
339 static const char *date_order_arg = "--date-order"; 334 argv_array_push(&rev_argv, "--date-order");
340 argv_array_push(&rev_argv, date_order_arg); 335 else if (commit_sort == 2)
341 } else if (commit_sort == 2) { 336 argv_array_push(&rev_argv, "--topo-order");
342 static const char *topo_order_arg = "--topo-order";
343 argv_array_push(&rev_argv, topo_order_arg);
344 }
345 337
346 if (path) { 338 if (path) {
347 static const char *double_dash_arg = "--"; 339 argv_array_push(&rev_argv, "--");
348 argv_array_push(&rev_argv, double_dash_arg);
349 argv_array_push(&rev_argv, path); 340 argv_array_push(&rev_argv, path);
350 } 341 }
351 342
@@ -437,5 +428,4 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
437 /* If we allocated tip then it is safe to cast away const. */ 428 /* If we allocated tip then it is safe to cast away const. */
438 if (must_free_tip) 429 if (must_free_tip)
439 free((char*) tip); 430 free((char*) tip);
440 strbuf_release(&argbuf);
441} 431}