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:
parent
d9f6f3b619
commit
a6293f5d28
@ -954,18 +954,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
|
|||||||
kind = "";
|
kind = "";
|
||||||
what = "";
|
what = "";
|
||||||
}
|
}
|
||||||
else if (starts_with(rm->name, "refs/heads/")) {
|
else if (skip_prefix(rm->name, "refs/heads/", &what))
|
||||||
kind = "branch";
|
kind = "branch";
|
||||||
what = rm->name + 11;
|
else if (skip_prefix(rm->name, "refs/tags/", &what))
|
||||||
}
|
|
||||||
else if (starts_with(rm->name, "refs/tags/")) {
|
|
||||||
kind = "tag";
|
kind = "tag";
|
||||||
what = rm->name + 10;
|
else if (skip_prefix(rm->name, "refs/remotes/", &what))
|
||||||
}
|
|
||||||
else if (starts_with(rm->name, "refs/remotes/")) {
|
|
||||||
kind = "remote-tracking branch";
|
kind = "remote-tracking branch";
|
||||||
what = rm->name + 13;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
kind = "";
|
kind = "";
|
||||||
what = rm->name;
|
what = rm->name;
|
||||||
|
Loading…
Reference in New Issue
Block a user