@matheusbsbs / matheus-bagliano / commits / afdcec7366
Fork 0

show-branch: mark active branch with a '*' again

This was lost in the packed-ref updates. The original test was a bit dubious, so I cleaned that up, too. It fixes the case when the current HEAD is refs/heads/bla/master: the original test was true for both bla/master _and_ master. However, it shares a hard-to-fix bug with the original test: if the current HEAD is refs/heads/master, and there is a branch refs/heads/heads/master, then both are marked active. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Sep 22, 2006 at 00:07 UTC afdcec73660737d0ac28a808829ab76587a9befa
1 file changed +6
builtin-show-branch.c
+6
@@ -443,6 +443,12 @@ static int rev_is_head(char *head, int headlen, char *name,
443 if ((!head[0]) ||
444 (head_sha1 && sha1 && hashcmp(head_sha1, sha1)))
445 return 0;
446 + if (!strncmp(head, "refs/heads/", 11))
447 + head += 11;
448 + if (!strncmp(name, "refs/heads/", 11))
449 + name += 11;
450 + else if (!strncmp(name, "heads/", 6))
451 + name += 6;
452 return !strcmp(head, name);
453 }
454