dir: check pathspecs before returning `path_excluded`
authorMartin Ågren <redacted>
Mon, 20 Jul 2020 18:45:29 +0000 (20:45 +0200)
committerJunio C Hamano <redacted>
Mon, 20 Jul 2020 20:25:07 +0000 (13:25 -0700)
commitcada7308ade0b9a018f9c54ea3f226e2e9c39ee5
tree2f8e26c08a19b515d3adbacd3f81a4024e1c0da7
parentc0af173a136785b3cfad4bd414b2fb10a130760a
dir: check pathspecs before returning `path_excluded`

In 95c11ecc73 ("Fix error-prone fill_directory() API; make it only
return matches", 2020-04-01), we taught `fill_directory()`, or more
specifically `treat_path()`, to check against any pathspecs so that we
could simplify the callers.

But in doing so, we added a slightly-too-early return for the "excluded"
case. We end up not checking the pathspecs, meaning we return
`path_excluded` when maybe we should return `path_none`. As a result,
`git status --ignored -- pathspec` might show paths that don't actually
match "pathspec".

Move the "excluded" check down to after we've checked any pathspecs.

Reported-by: Andreas Schwab <redacted>
Reviewed-by: Elijah Newren <redacted>
Signed-off-by: Martin Ågren <redacted>
Signed-off-by: Junio C Hamano <redacted>
dir.c
t/t7061-wtstatus-ignore.sh
git clone https://git.99rst.org/PROJECT