Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2020-07-20 21:45:29 +0300
committerJunio C Hamano <gitster@pobox.com>2020-07-20 23:25:07 +0300
commitcada7308ade0b9a018f9c54ea3f226e2e9c39ee5 (patch)
tree2f8e26c08a19b515d3adbacd3f81a4024e1c0da7 /t/t7061-wtstatus-ignore.sh
parentc0af173a136785b3cfad4bd414b2fb10a130760a (diff)
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 <schwab@linux-m68k.org> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7061-wtstatus-ignore.sh')
-rwxr-xr-xt/t7061-wtstatus-ignore.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t7061-wtstatus-ignore.sh b/t/t7061-wtstatus-ignore.sh
index e4cf5484f9..2f9bea9793 100755
--- a/t/t7061-wtstatus-ignore.sh
+++ b/t/t7061-wtstatus-ignore.sh
@@ -30,6 +30,31 @@ test_expect_success 'same with gitignore starting with BOM' '
test_cmp expected actual
'
+test_expect_success 'status untracked files --ignored with pathspec (no match)' '
+ git status --porcelain --ignored -- untracked/i >actual &&
+ test_must_be_empty actual &&
+ git status --porcelain --ignored -- untracked/u >actual &&
+ test_must_be_empty actual
+'
+
+test_expect_success 'status untracked files --ignored with pathspec (literal match)' '
+ git status --porcelain --ignored -- untracked/ignored >actual &&
+ echo "!! untracked/ignored" >expected &&
+ test_cmp expected actual &&
+ git status --porcelain --ignored -- untracked/uncommitted >actual &&
+ echo "?? untracked/uncommitted" >expected &&
+ test_cmp expected actual
+'
+
+test_expect_success 'status untracked files --ignored with pathspec (glob match)' '
+ git status --porcelain --ignored -- untracked/i\* >actual &&
+ echo "!! untracked/ignored" >expected &&
+ test_cmp expected actual &&
+ git status --porcelain --ignored -- untracked/u\* >actual &&
+ echo "?? untracked/uncommitted" >expected &&
+ test_cmp expected actual
+'
+
cat >expected <<\EOF
?? .gitignore
?? actual