diff options
-rw-r--r-- | ui-log.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/ui-log.c b/ui-log.c index 641a5b6..d6d94f6 100644 --- a/ui-log.c +++ b/ui-log.c | |||
@@ -65,36 +65,34 @@ 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 | if (starts_with(deco->name, "refs/heads/")) { | 68 | strncpy(buf, prettify_refname(deco->name), sizeof(buf) - 1); |
69 | strncpy(buf, deco->name + 11, sizeof(buf) - 1); | 69 | switch(deco->type) { |
70 | case DECORATION_NONE: | ||
71 | /* If the git-core doesn't recognize it, | ||
72 | * don't display anything. */ | ||
73 | break; | ||
74 | case DECORATION_REF_LOCAL: | ||
70 | cgit_log_link(buf, NULL, "branch-deco", buf, NULL, | 75 | cgit_log_link(buf, NULL, "branch-deco", buf, NULL, |
71 | ctx.qry.vpath, 0, NULL, NULL, | 76 | ctx.qry.vpath, 0, NULL, NULL, |
72 | ctx.qry.showmsg, 0); | 77 | ctx.qry.showmsg, 0); |
73 | } | 78 | break; |
74 | else if (starts_with(deco->name, "tag: refs/tags/")) { | 79 | case DECORATION_REF_TAG: |
75 | strncpy(buf, deco->name + 15, sizeof(buf) - 1); | ||
76 | cgit_tag_link(buf, NULL, "tag-deco", buf); | ||
77 | } | ||
78 | else if (starts_with(deco->name, "refs/tags/")) { | ||
79 | strncpy(buf, deco->name + 10, sizeof(buf) - 1); | ||
80 | cgit_tag_link(buf, NULL, "tag-deco", buf); | 80 | cgit_tag_link(buf, NULL, "tag-deco", buf); |
81 | } | 81 | break; |
82 | else if (starts_with(deco->name, "refs/remotes/")) { | 82 | case DECORATION_REF_REMOTE: |
83 | if (!ctx.repo->enable_remote_branches) | 83 | if (!ctx.repo->enable_remote_branches) |
84 | goto next; | 84 | break; |
85 | strncpy(buf, deco->name + 13, sizeof(buf) - 1); | ||
86 | cgit_log_link(buf, NULL, "remote-deco", NULL, | 85 | cgit_log_link(buf, NULL, "remote-deco", NULL, |
87 | oid_to_hex(&commit->object.oid), | 86 | oid_to_hex(&commit->object.oid), |
88 | ctx.qry.vpath, 0, NULL, NULL, | 87 | ctx.qry.vpath, 0, NULL, NULL, |
89 | ctx.qry.showmsg, 0); | 88 | ctx.qry.showmsg, 0); |
90 | } | 89 | break; |
91 | else { | 90 | default: |
92 | strncpy(buf, deco->name, sizeof(buf) - 1); | ||
93 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, | 91 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, |
94 | oid_to_hex(&commit->object.oid), | 92 | oid_to_hex(&commit->object.oid), |
95 | ctx.qry.vpath); | 93 | ctx.qry.vpath); |
94 | break; | ||
96 | } | 95 | } |
97 | next: | ||
98 | deco = deco->next; | 96 | deco = deco->next; |
99 | } | 97 | } |
100 | html("</span>"); | 98 | html("</span>"); |