decoration: do not mis-decorate refs with same prefix

We definitely do not want to decorate refs/headsandtails the same as
refs/heads/*, for example.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2011-08-18 19:29:34 +07:00 committed by Junio C Hamano
parent f696543dad
commit 594ffe80e7

View File

@ -95,11 +95,11 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
if (!obj)
return 0;
if (!prefixcmp(refname, "refs/heads"))
if (!prefixcmp(refname, "refs/heads/"))
type = DECORATION_REF_LOCAL;
else if (!prefixcmp(refname, "refs/remotes"))
else if (!prefixcmp(refname, "refs/remotes/"))
type = DECORATION_REF_REMOTE;
else if (!prefixcmp(refname, "refs/tags"))
else if (!prefixcmp(refname, "refs/tags/"))
type = DECORATION_REF_TAG;
else if (!prefixcmp(refname, "refs/stash"))
type = DECORATION_REF_STASH;