aboutsummaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2017-03-23 16:50:12 +0100
committerJunio C Hamano <gitster@pobox.com>2017-03-23 11:22:01 -0700
commit3e5b36c6378da0be3f5371cb1f2a3f84e1952fae (patch)
tree1ba9719b71eecbfcb7a9e2cf3baf8236d6cf7d37 /refs.c
parentc3808ca6982b0ad7ee9b87eca9b50b9a24ec08b0 (diff)
downloadgit-3e5b36c6378da0be3f5371cb1f2a3f84e1952fae.tar.gz
git-3e5b36c6378da0be3f5371cb1f2a3f84e1952fae.tar.xz
refs.c: use skip_prefix() in prettify_refname()
This eliminates three magic numbers. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 62055ab09..49a7e703d 100644
--- a/refs.c
+++ b/refs.c
@@ -346,11 +346,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[] = {