From 2059e79c0dac1e1e4e55733618dc6ca9d00b8aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 26 Nov 2019 16:23:31 +0100 Subject: name-rev: use skip_prefix() instead of starts_with() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let skip_prefix() advance refname to get rid of two magic numbers. Signed-off-by: René Scharfe Acked-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/name-rev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/name-rev.c b/builtin/name-rev.c index b0f0776947..e55a4f04ee 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -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; } -- cgit v1.2.3