summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-11-26 11:18:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-27 02:17:22 (GMT)
commita6293f5d28763580dd1035d3c6b018b42be7e25a (patch)
tree1b12d8468ed6aade4c63949f0adb45f09dbfe5fb /builtin/fetch.c
parentd9f6f3b6195a0ca35642561e530798ad1469bd41 (diff)
downloadgit-a6293f5d28763580dd1035d3c6b018b42be7e25a.zip
git-a6293f5d28763580dd1035d3c6b018b42be7e25a.tar.gz
git-a6293f5d28763580dd1035d3c6b018b42be7e25a.tar.bz2
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>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 863c858..02e8619 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;