Skip to content

Commit afb456a

Browse files
committed
Merge branch 'cc/ref-is-hidden-microcleanup'
Code cleanup. * cc/ref-is-hidden-microcleanup: refs: use skip_prefix() in ref_is_hidden()
2 parents 4a636e7 + 7a40a95 commit afb456a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

refs.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ int ref_is_hidden(const char *refname, const char *refname_full)
11601160
const char *match = hide_refs->items[i].string;
11611161
const char *subject;
11621162
int neg = 0;
1163-
int len;
1163+
const char *p;
11641164

11651165
if (*match == '!') {
11661166
neg = 1;
@@ -1175,10 +1175,9 @@ int ref_is_hidden(const char *refname, const char *refname_full)
11751175
}
11761176

11771177
/* refname can be NULL when namespaces are used. */
1178-
if (!subject || !starts_with(subject, match))
1179-
continue;
1180-
len = strlen(match);
1181-
if (!subject[len] || subject[len] == '/')
1178+
if (subject &&
1179+
skip_prefix(subject, match, &p) &&
1180+
(!*p || *p == '/'))
11821181
return !neg;
11831182
}
11841183
return 0;

0 commit comments

Comments
 (0)