Skip to content

Commit e6efecc

Browse files
pcloudsgitster
authored andcommitted
dir.c: make last_exclude_matching_from_list() run til the end
The next patch adds some post processing to the result value before it's returned to the caller. Keep all branches reach the end of the function, so we can do it all in one place. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ecad27c commit e6efecc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

dir.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
752752
int *dtype,
753753
struct exclude_list *el)
754754
{
755+
struct exclude *exc = NULL; /* undecided */
755756
int i;
756757

757758
if (!el->nr)
@@ -773,18 +774,22 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
773774
if (match_basename(basename,
774775
pathlen - (basename - pathname),
775776
exclude, prefix, x->patternlen,
776-
x->flags))
777-
return x;
777+
x->flags)) {
778+
exc = x;
779+
break;
780+
}
778781
continue;
779782
}
780783

781784
assert(x->baselen == 0 || x->base[x->baselen - 1] == '/');
782785
if (match_pathname(pathname, pathlen,
783786
x->base, x->baselen ? x->baselen - 1 : 0,
784-
exclude, prefix, x->patternlen, x->flags))
785-
return x;
787+
exclude, prefix, x->patternlen, x->flags)) {
788+
exc = x;
789+
break;
790+
}
786791
}
787-
return NULL; /* undecided */
792+
return exc;
788793
}
789794

790795
/*

0 commit comments

Comments
 (0)