name-rev: use skip_prefix() instead of starts_with()
Let skip_prefix() advance refname to get rid of two magic numbers. Signed-off-by: René Scharfe <l.s.r@web.de> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1768aaf01d
commit
2059e79c0d
@ -161,10 +161,10 @@ static const char *name_ref_abbrev(const char *refname, int shorten_unambiguous)
|
||||
{
|
||||
if (shorten_unambiguous)
|
||||
refname = shorten_unambiguous_ref(refname, 0);
|
||||
else if (starts_with(refname, "refs/heads/"))
|
||||
refname = refname + 11;
|
||||
else if (starts_with(refname, "refs/"))
|
||||
refname = refname + 5;
|
||||
else if (skip_prefix(refname, "refs/heads/", &refname))
|
||||
; /* refname already advanced */
|
||||
else
|
||||
skip_prefix(refname, "refs/", &refname);
|
||||
return refname;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user