1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 19:56:11 +02:00

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 <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:
René Scharfe 2019-11-26 12:18:26 +01:00 committed by Junio C Hamano
parent d9f6f3b619
commit a6293f5d28

View File

@ -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;