Skip to content

Commit f494890

Browse files
committed
Merge branch 'sg/skip-prefix-in-prettify-refname'
Code cleanup. * sg/skip-prefix-in-prettify-refname: refs.c: use skip_prefix() in prettify_refname()
2 parents e779b0f + 3e5b36c commit f494890

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

refs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
366366

367367
const char *prettify_refname(const char *name)
368368
{
369-
return name + (
370-
starts_with(name, "refs/heads/") ? 11 :
371-
starts_with(name, "refs/tags/") ? 10 :
372-
starts_with(name, "refs/remotes/") ? 13 :
373-
0);
369+
if (skip_prefix(name, "refs/heads/", &name) ||
370+
skip_prefix(name, "refs/tags/", &name) ||
371+
skip_prefix(name, "refs/remotes/", &name))
372+
; /* nothing */
373+
return name;
374374
}
375375

376376
static const char *ref_rev_parse_rules[] = {

0 commit comments

Comments
 (0)