Skip to content

Commit 4909bbe

Browse files
committed
Merge branch 'dm/tree-walk'
* dm/tree-walk: tree-walk: micro-optimization in tree_entry_interesting tree-walk: drop unused parameter from match_dir_prefix
2 parents 59b32ff + 1b74092 commit 4909bbe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tree-walk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static int match_entry(const struct name_entry *entry, int pathlen,
549549
return 0;
550550
}
551551

552-
static int match_dir_prefix(const char *base, int baselen,
552+
static int match_dir_prefix(const char *base,
553553
const char *match, int matchlen)
554554
{
555555
if (strncmp(base, match, matchlen))
@@ -606,7 +606,7 @@ int tree_entry_interesting(const struct name_entry *entry,
606606

607607
if (baselen >= matchlen) {
608608
/* If it doesn't match, move along... */
609-
if (!match_dir_prefix(base_str, baselen, match, matchlen))
609+
if (!match_dir_prefix(base_str, match, matchlen))
610610
goto match_wildcards;
611611

612612
if (!ps->recursive || ps->max_depth == -1)
@@ -618,8 +618,8 @@ int tree_entry_interesting(const struct name_entry *entry,
618618
ps->max_depth);
619619
}
620620

621-
/* Does the base match? */
622-
if (!strncmp(base_str, match, baselen)) {
621+
/* Either there must be no base, or the base must match. */
622+
if (baselen == 0 || !strncmp(base_str, match, baselen)) {
623623
if (match_entry(entry, pathlen,
624624
match + baselen, matchlen - baselen,
625625
&never_interesting))

0 commit comments

Comments
 (0)