aboutsummaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-28 14:05:59 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-28 14:05:59 -0700
commitf4948902923685134bc01292f2c97315eab6c82a (patch)
tree8f1549dbbd71d1467f7b5eed2e058ed4b53630f8 /refs.c
parente779b0f0703d1e85e35b2772ae458e89eca0f0d3 (diff)
parent3e5b36c6378da0be3f5371cb1f2a3f84e1952fae (diff)
downloadgit-f4948902923685134bc01292f2c97315eab6c82a.tar.gz
git-f4948902923685134bc01292f2c97315eab6c82a.tar.xz
Merge branch 'sg/skip-prefix-in-prettify-refname'
Code cleanup. * sg/skip-prefix-in-prettify-refname: refs.c: use skip_prefix() in prettify_refname()
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/refs.c b/refs.c
index e7606716d..0272e332c 100644
--- a/refs.c
+++ b/refs.c
@@ -366,11 +366,11 @@ int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
const char *prettify_refname(const char *name)
{
- return name + (
- starts_with(name, "refs/heads/") ? 11 :
- starts_with(name, "refs/tags/") ? 10 :
- starts_with(name, "refs/remotes/") ? 13 :
- 0);
+ if (skip_prefix(name, "refs/heads/", &name) ||
+ skip_prefix(name, "refs/tags/", &name) ||
+ skip_prefix(name, "refs/remotes/", &name))
+ ; /* nothing */
+ return name;
}
static const char *ref_rev_parse_rules[] = {