summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-08-23 14:33:50 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-08-23 14:33:50 -0700
commitd0dffcacf3a721789984aed5a5e0af738b1d9f36 (patch)
treeabbc3b383fa798886d226aa61dfaa20560a34f3d /refs.c
parentMerge branch 'js/run-process-parallel-api-fix' into maint (diff)
parentrefs: use skip_prefix() in ref_is_hidden() (diff)
downloadtgif-d0dffcacf3a721789984aed5a5e0af738b1d9f36.tar.xz
Merge branch 'cc/ref-is-hidden-microcleanup' into maint
Code cleanup. * cc/ref-is-hidden-microcleanup: refs: use skip_prefix() in ref_is_hidden()
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/refs.c b/refs.c
index ba22f4acef..ea2b9f84f8 100644
--- a/refs.c
+++ b/refs.c
@@ -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;