about summary refs log tree commit diff
path: root/ui-log.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-log.c')
-rw-r--r--ui-log.c46
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)
 		return;
 	html("<span class='decoration'>");
 	while (deco) {
-		if (starts_with(deco->name, "refs/heads/")) {
-			strncpy(buf, deco->name + 11, sizeof(buf) - 1);
+		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);
+				ctx.qry.vpath, 0, NULL, NULL,
+				ctx.qry.showmsg, 0);
+			break;
+		case DECORATION_REF_TAG:
 			cgit_tag_link(buf, NULL, "tag-deco", buf);
-		}
-		else if (starts_with(deco->name, "refs/remotes/")) {
+			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("</span>");
1:16 -0400'>2018-09-14Apply consecutive formatting codes at onceJune McEnroe Fixes the failing splits test. 2018-09-14Add tests for formatParseJune McEnroe With one currently failing so you know they're worth it. 2018-09-13Preview with nick in input windowJune McEnroe 2018-09-13Never send PRIVMSG to TagStatus or TagVerboseJune McEnroe 2018-09-13Move color selection to format.cJune McEnroe 2018-09-13Fix len for format->split at end of stringJune McEnroe 2018-09-13Avoid uninitialized x in uiReadJune McEnroe 2018-09-13Add IRCDefault to colors enumJune McEnroe 2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe I have no idea why I did this. 2018-09-13Rewrite UI againJune McEnroe The persistent topic is gone and the status line is now at the top. The status formatting still needs to be reworked. I also want to try showing the nick in the input window so it really looks like your next message. 2018-09-12Add note about C-oJune McEnroe Why are there so few well usable ctrl key bindings? 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe Ridiculous. 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe