X-Git-Url: https://git.cameronkatri.com/cgit.git/blobdiff_plain/baa5ad1f80f56d3c0b0095bfb468fab28c9b4982..53efaf30b50f095cad8c160488c74bba3e3b2680:/ui-log.c diff --git a/ui-log.c b/ui-log.c index a4dc707..d696e20 100644 --- a/ui-log.c +++ b/ui-log.c @@ -49,7 +49,7 @@ static void inspect_files(struct diff_filepair *pair) files++; if (ctx.repo->enable_log_linecount) - cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, + cgit_diff_files(&pair->one->oid, &pair->two->oid, &old_size, &new_size, &binary, 0, ctx.qry.ignorews, count_lines); } @@ -61,38 +61,42 @@ void show_commit_decorations(struct commit *commit) buf[sizeof(buf) - 1] = 0; deco = get_name_decoration(&commit->object); + if (!deco) + return; html(""); while (deco) { - if (starts_with(deco->name, "refs/heads/")) { - strncpy(buf, deco->name + 11, sizeof(buf) - 1); + struct object_id peeled; + int is_annotated = 0; + strncpy(buf, prettify_refname(deco->name), sizeof(buf) - 1); + switch(deco->type) { + case DECORATION_NONE: + /* If the git-core doesn't recognize it, + * don't display anything. */ + break; + case DECORATION_REF_LOCAL: cgit_log_link(buf, NULL, "branch-deco", buf, NULL, - ctx.qry.vpath, 0, NULL, NULL, - ctx.qry.showmsg, 0); - } - else if (starts_with(deco->name, "tag: refs/tags/")) { - strncpy(buf, deco->name + 15, sizeof(buf) - 1); - cgit_tag_link(buf, NULL, "tag-deco", buf); - } - else if (starts_with(deco->name, "refs/tags/")) { - strncpy(buf, deco->name + 10, sizeof(buf) - 1); - cgit_tag_link(buf, NULL, "tag-deco", buf); - } - else if (starts_with(deco->name, "refs/remotes/")) { + ctx.qry.vpath, 0, NULL, NULL, + ctx.qry.showmsg, 0); + break; + case DECORATION_REF_TAG: + if (!peel_ref(deco->name, &peeled)) + is_annotated = !oidcmp(&commit->object.oid, &peeled); + cgit_tag_link(buf, NULL, is_annotated ? "tag-annotated-deco" : "tag-deco", buf); + break; + case DECORATION_REF_REMOTE: if (!ctx.repo->enable_remote_branches) - goto next; - strncpy(buf, deco->name + 13, sizeof(buf) - 1); + break; cgit_log_link(buf, NULL, "remote-deco", NULL, - oid_to_hex(&commit->object.oid), - ctx.qry.vpath, 0, NULL, NULL, - ctx.qry.showmsg, 0); - } - else { - strncpy(buf, deco->name, sizeof(buf) - 1); + oid_to_hex(&commit->object.oid), + ctx.qry.vpath, 0, NULL, NULL, + ctx.qry.showmsg, 0); + break; + default: cgit_commit_link(buf, NULL, "deco", ctx.qry.head, - oid_to_hex(&commit->object.oid), - ctx.qry.vpath); + oid_to_hex(&commit->object.oid), + ctx.qry.vpath); + break; } -next: deco = deco->next; } html(""); @@ -119,8 +123,7 @@ static int show_commit(struct commit *commit, struct rev_info *revs) struct commit_list *parents = commit->parents; struct commit *parent; int found = 0, saved_fmt; - unsigned saved_flags = revs->diffopt.flags; - + struct diff_flags saved_flags = revs->diffopt.flags; /* Always show if we're not in "follow" mode with a single file. */ if (!ctx.qry.follow) @@ -149,10 +152,10 @@ static int show_commit(struct commit *commit, struct rev_info *revs) add_lines = 0; rem_lines = 0; - DIFF_OPT_SET(&revs->diffopt, RECURSIVE); - diff_tree_sha1(parent->tree->object.oid.hash, - commit->tree->object.oid.hash, - "", &revs->diffopt); + revs->diffopt.flags.recursive = 1; + diff_tree_oid(&parent->maybe_tree->object.oid, + &commit->maybe_tree->object.oid, + "", &revs->diffopt); diffcore_std(&revs->diffopt); found = !diff_queue_is_empty(); @@ -204,7 +207,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) } else { html("