From: René Scharfe Date: Tue, 26 Nov 2019 11:18:26 +0000 (+0100) Subject: fetch: use skip_prefix() instead of starts_with() X-Git-Tag: v2.25.0-rc0~61^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a6293f5d28763580dd1035d3c6b018b42be7e25a;p=thirdparty%2Fgit.git fetch: use skip_prefix() instead of starts_with() Get rid of magic numbers by letting skip_prefix() set the pointer "what". Signed-off-by: René Scharfe Acked-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/builtin/fetch.c b/builtin/fetch.c index 863c858fde..02e8619618 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -954,18 +954,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name, kind = ""; what = ""; } - else if (starts_with(rm->name, "refs/heads/")) { + else if (skip_prefix(rm->name, "refs/heads/", &what)) kind = "branch"; - what = rm->name + 11; - } - else if (starts_with(rm->name, "refs/tags/")) { + else if (skip_prefix(rm->name, "refs/tags/", &what)) kind = "tag"; - what = rm->name + 10; - } - else if (starts_with(rm->name, "refs/remotes/")) { + else if (skip_prefix(rm->name, "refs/remotes/", &what)) kind = "remote-tracking branch"; - what = rm->name + 13; - } else { kind = ""; what = rm->name;