diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2017-03-23 16:50:12 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-23 11:22:01 -0700 |
commit | 3e5b36c6378da0be3f5371cb1f2a3f84e1952fae (patch) | |
tree | 1ba9719b71eecbfcb7a9e2cf3baf8236d6cf7d37 | |
parent | c3808ca6982b0ad7ee9b87eca9b50b9a24ec08b0 (diff) | |
download | git-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>
-rw-r--r-- | refs.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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[] = { |