summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-12-06 15:09:22 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-12-06 15:09:22 -0800
commit391fb22ac760042fd1cffe451f4ec9a4eb57e39e (patch)
treea933c90fefc73a2e6625ceec79043330b870c128 /builtin/fetch.c
parentMerge branch 'rs/simplify-prepare-cmd' (diff)
parentname-rev: use skip_prefix() instead of starts_with() (diff)
downloadtgif-391fb22ac760042fd1cffe451f4ec9a4eb57e39e.tar.xz
Merge branch 'rs/use-skip-prefix-more'
Code cleanup. * rs/use-skip-prefix-more: name-rev: use skip_prefix() instead of starts_with() push: use skip_prefix() instead of starts_with() shell: use skip_prefix() instead of starts_with() fmt-merge-msg: use skip_prefix() instead of starts_with() fetch: use skip_prefix() instead of starts_with()
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 46ce7c2710..f8765b385b 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -957,18 +957,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;