From 072a231016e5da347c3a8ff38afb72e7876dd1d7 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 10 Dec 2019 20:00:23 +0000 Subject: dir: exit before wildcard fall-through if there is no wildcard The DO_MATCH_LEADING_PATHSPEC had a fall-through case for if there was a wildcard, noting that we don't yet have enough information to determine if a further paths under the current directory might match due to the presence of wildcards. But if we have no wildcards in our pathspec, then we shouldn't get to that fall-through case. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- dir.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dir.c') diff --git a/dir.c b/dir.c index 5dacacd469..517a569e10 100644 --- a/dir.c +++ b/dir.c @@ -379,6 +379,13 @@ static int match_pathspec_item(const struct index_state *istate, item->nowildcard_len - prefix)) return 0; + /* + * name has no wildcard, and it didn't match as a leading + * pathspec so return. + */ + if (item->nowildcard_len == item->len) + return 0; + /* * Here is where we would perform a wildmatch to check if * "name" can be matched as a directory (or a prefix) against -- cgit v1.2.3