diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-08-11 13:27:03 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-11 13:27:03 -0700 |
commit | afb456a3835b8b22ec6420807243df480a61d815 (patch) | |
tree | 1e67255cf3c449fbb727cdc3dd23f036626ed78a /refs.c | |
parent | 4a636e7682ad46a4fe8eef71ae7917e0d95585f4 (diff) | |
parent | 7a40a95eb4f79517750eb2bcd81342c25c6db406 (diff) | |
download | git-afb456a3835b8b22ec6420807243df480a61d815.tar.gz |
Merge branch 'cc/ref-is-hidden-microcleanup'
Code cleanup.
* cc/ref-is-hidden-microcleanup:
refs: use skip_prefix() in ref_is_hidden()
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1160,7 +1160,7 @@ int ref_is_hidden(const char *refname, const char *refname_full) const char *match = hide_refs->items[i].string; const char *subject; int neg = 0; - int len; + const char *p; if (*match == '!') { neg = 1; @@ -1175,10 +1175,9 @@ int ref_is_hidden(const char *refname, const char *refname_full) } /* refname can be NULL when namespaces are used. */ - if (!subject || !starts_with(subject, match)) - continue; - len = strlen(match); - if (!subject[len] || subject[len] == '/') + if (subject && + skip_prefix(subject, match, &p) && + (!*p || *p == '/')) return !neg; } return 0; |