@@ -549,7 +549,7 @@ static int match_entry(const struct name_entry *entry, int pathlen,
549
549
return 0 ;
550
550
}
551
551
552
- static int match_dir_prefix (const char * base , int baselen ,
552
+ static int match_dir_prefix (const char * base ,
553
553
const char * match , int matchlen )
554
554
{
555
555
if (strncmp (base , match , matchlen ))
@@ -606,7 +606,7 @@ int tree_entry_interesting(const struct name_entry *entry,
606
606
607
607
if (baselen >= matchlen ) {
608
608
/* 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 ))
610
610
goto match_wildcards ;
611
611
612
612
if (!ps -> recursive || ps -> max_depth == -1 )
@@ -618,8 +618,8 @@ int tree_entry_interesting(const struct name_entry *entry,
618
618
ps -> max_depth );
619
619
}
620
620
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 )) {
623
623
if (match_entry (entry , pathlen ,
624
624
match + baselen , matchlen - baselen ,
625
625
& never_interesting ))
0 commit comments