about summary refs log tree commit diff stats
path: root/ui-log.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-log.c')
-rw-r--r--ui-log.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/ui-log.c b/ui-log.c index 773950c..b443ca7 100644 --- a/ui-log.c +++ b/ui-log.c
@@ -10,7 +10,7 @@
10#include "ui-log.h" 10#include "ui-log.h"
11#include "html.h" 11#include "html.h"
12#include "ui-shared.h" 12#include "ui-shared.h"
13#include "argv-array.h" 13#include "strvec.h"
14 14
15static int files, add_lines, rem_lines, lines_counted; 15static int files, add_lines, rem_lines, lines_counted;
16 16
@@ -65,7 +65,7 @@ void show_commit_decorations(struct commit *commit)
65 return; 65 return;
66 html("<span class='decoration'>"); 66 html("<span class='decoration'>");
67 while (deco) { 67 while (deco) {
68 struct object_id peeled; 68 struct object_id oid_tag, peeled;
69 int is_annotated = 0; 69 int is_annotated = 0;
70 70
71 strlcpy(buf, prettify_refname(deco->name), sizeof(buf)); 71 strlcpy(buf, prettify_refname(deco->name), sizeof(buf));
@@ -82,8 +82,8 @@ void show_commit_decorations(struct commit *commit)
82 break; 82 break;
83 case DECORATION_REF_TAG: 83 case DECORATION_REF_TAG:
84 html(" "); 84 html(" ");
85 if (!peel_ref(deco->name, &peeled)) 85 if (!read_ref(deco->name, &oid_tag) && !peel_iterated_oid(&oid_tag, &peeled))
86 is_annotated = !oidcmp(&commit->object.oid, &peeled); 86 is_annotated = !oideq(&oid_tag, &peeled);
87 cgit_tag_link(buf, NULL, is_annotated ? "tag-annotated-deco" : "tag-deco", buf); 87 cgit_tag_link(buf, NULL, is_annotated ? "tag-annotated-deco" : "tag-deco", buf);
88 break; 88 break;
89 case DECORATION_REF_REMOTE: 89 case DECORATION_REF_REMOTE:
@@ -371,23 +371,23 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
371{ 371{
372 struct rev_info rev; 372 struct rev_info rev;
373 struct commit *commit; 373 struct commit *commit;
374 struct argv_array rev_argv = ARGV_ARRAY_INIT; 374 struct strvec rev_argv = STRVEC_INIT;
375 int i, columns = commit_graph ? 4 : 3; 375 int i, columns = commit_graph ? 4 : 3;
376 int must_free_tip = 0; 376 int must_free_tip = 0;
377 377
378 /* rev_argv.argv[0] will be ignored by setup_revisions */ 378 /* rev_argv.argv[0] will be ignored by setup_revisions */
379 argv_array_push(&rev_argv, "log_rev_setup"); 379 strvec_push(&rev_argv, "log_rev_setup");
380 380
381 if (!tip) 381 if (!tip)
382 tip = ctx.qry.head; 382 tip = ctx.qry.head;
383 tip = disambiguate_ref(tip, &must_free_tip); 383 tip = disambiguate_ref(tip, &must_free_tip);
384 argv_array_push(&rev_argv, tip); 384 strvec_push(&rev_argv, tip);
385 385
386 if (grep && pattern && *pattern) { 386 if (grep && pattern && *pattern) {
387 pattern = xstrdup(pattern); 387 pattern = xstrdup(pattern);
388 if (!strcmp(grep, "grep") || !strcmp(grep, "author") || 388 if (!strcmp(grep, "grep") || !strcmp(grep, "author") ||
389 !strcmp(grep, "committer")) { 389 !strcmp(grep, "committer")) {
390 argv_array_pushf(&rev_argv, "--%s=%s", grep, pattern); 390 strvec_pushf(&rev_argv, "--%s=%s", grep, pattern);
391 } else if (!strcmp(grep, "range")) { 391 } else if (!strcmp(grep, "range")) {
392 char *arg; 392 char *arg;
393 /* Split the pattern at whitespace and add each token 393 /* Split the pattern at whitespace and add each token
@@ -395,14 +395,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
395 * rev-list options. Also, replace the previously 395 * rev-list options. Also, replace the previously
396 * pushed tip (it's no longer relevant). 396 * pushed tip (it's no longer relevant).
397 */ 397 */
398 argv_array_pop(&rev_argv); 398 strvec_pop(&rev_argv);
399 while ((arg = next_token(&pattern))) { 399 while ((arg = next_token(&pattern))) {
400 if (*arg == '-') { 400 if (*arg == '-') {
401 fprintf(stderr, "Bad range expr: %s\n", 401 fprintf(stderr, "Bad range expr: %s\n",
402 arg); 402 arg);
403 break; 403 break;
404 } 404 }
405 argv_array_push(&rev_argv, arg); 405 strvec_push(&rev_argv, arg);
406 } 406 }
407 } 407 }
408 } 408 }
@@ -417,22 +417,22 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
417 } 417 }
418 418
419 if (commit_graph && !ctx.qry.follow) { 419 if (commit_graph && !ctx.qry.follow) {
420 argv_array_push(&rev_argv, "--graph"); 420 strvec_push(&rev_argv, "--graph");
421 argv_array_push(&rev_argv, "--color"); 421 strvec_push(&rev_argv, "--color");
422 graph_set_column_colors(column_colors_html, 422 graph_set_column_colors(column_colors_html,
423 COLUMN_COLORS_HTML_MAX); 423 COLUMN_COLORS_HTML_MAX);
424 } 424 }
425 425
426 if (commit_sort == 1) 426 if (commit_sort == 1)
427 argv_array_push(&rev_argv, "--date-order"); 427 strvec_push(&rev_argv, "--date-order");
428 else if (commit_sort == 2) 428 else if (commit_sort == 2)
429 argv_array_push(&rev_argv, "--topo-order"); 429 strvec_push(&rev_argv, "--topo-order");
430 430
431 if (path && ctx.qry.follow) 431 if (path && ctx.qry.follow)
432 argv_array_push(&rev_argv, "--follow"); 432 strvec_push(&rev_argv, "--follow");
433 argv_array_push(&rev_argv, "--"); 433 strvec_push(&rev_argv, "--");
434 if (path) 434 if (path)
435 argv_array_push(&rev_argv, path); 435 strvec_push(&rev_argv, path);
436 436
437 init_revisions(&rev, NULL); 437 init_revisions(&rev, NULL);
438 rev.abbrev = DEFAULT_ABBREV; 438 rev.abbrev = DEFAULT_ABBREV;
@@ -441,7 +441,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
441 rev.show_root_diff = 0; 441 rev.show_root_diff = 0;
442 rev.ignore_missing = 1; 442 rev.ignore_missing = 1;
443 rev.simplify_history = 1; 443 rev.simplify_history = 1;
444 setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL); 444 setup_revisions(rev_argv.nr, rev_argv.v, &rev, NULL);
445 load_ref_decorations(NULL, DECORATE_FULL_REFS); 445 load_ref_decorations(NULL, DECORATE_FULL_REFS);
446 rev.show_decorations = 1; 446 rev.show_decorations = 1;
447 rev.grep_filter.ignore_case = 1; 447 rev.grep_filter.ignore_case = 1;
@@ -468,7 +468,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
468 if (pager) { 468 if (pager) {
469 html(" ("); 469 html(" (");
470 cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, 470 cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL,
471 NULL, ctx.qry.head, ctx.qry.sha1, 471 NULL, ctx.qry.head, ctx.qry.oid,
472 ctx.qry.vpath, ctx.qry.ofs, ctx.qry.grep, 472 ctx.qry.vpath, ctx.qry.ofs, ctx.qry.grep,
473 ctx.qry.search, ctx.qry.showmsg ? 0 : 1, 473 ctx.qry.search, ctx.qry.showmsg ? 0 : 1,
474 ctx.qry.follow); 474 ctx.qry.follow);
@@ -524,7 +524,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
524 if (ofs > 0) { 524 if (ofs > 0) {
525 html("<li>"); 525 html("<li>");
526 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, 526 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head,
527 ctx.qry.sha1, ctx.qry.vpath, 527 ctx.qry.oid, ctx.qry.vpath,
528 ofs - cnt, ctx.qry.grep, 528 ofs - cnt, ctx.qry.grep,
529 ctx.qry.search, ctx.qry.showmsg, 529 ctx.qry.search, ctx.qry.showmsg,
530 ctx.qry.follow); 530 ctx.qry.follow);
@@ -533,7 +533,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
533 if ((commit = get_revision(&rev)) != NULL) { 533 if ((commit = get_revision(&rev)) != NULL) {
534 html("<li>"); 534 html("<li>");
535 cgit_log_link("[next]", NULL, NULL, ctx.qry.head, 535 cgit_log_link("[next]", NULL, NULL, ctx.qry.head,
536 ctx.qry.sha1, ctx.qry.vpath, 536 ctx.qry.oid, ctx.qry.vpath,
537 ofs + cnt, ctx.qry.grep, 537 ofs + cnt, ctx.qry.grep,
538 ctx.qry.search, ctx.qry.showmsg, 538 ctx.qry.search, ctx.qry.showmsg,
539 ctx.qry.follow); 539 ctx.qry.follow);