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:
authorRené Scharfe <l.s.r@web.de>2018-02-10 15:38:29 +0300
committerJunio C Hamano <gitster@pobox.com>2018-02-13 00:09:35 +0300
commitd60771e93046e9e11183c6ff1fcafd334f8c0453 (patch)
treeb104f07d171ab35990d422e29534e2a5e6d67bb3 /t/t0008-ignores.sh
parentfc849d8d6b90e5c1e0c37bc0d60dd92b2fe7347f (diff)
check-ignore: fix mix of directories and other file types
In check_ignore(), the first pathspec item determines the dtype for any subsequent ones. That means that a pathspec matching a regular file can prevent following pathspecs from matching directories, which makes no sense. Fix that by determining the dtype for each pathspec separately, by passing the value DT_UNKNOWN to last_exclude_matching() each time. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0008-ignores.sh')
-rwxr-xr-xt/t0008-ignores.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index d27f438bf4..54a4703ef1 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -775,6 +775,26 @@ test_expect_success PIPE 'streaming support for --stdin' '
echo "$response" | grep "^:: two"
'
+test_expect_success 'existing file and directory' '
+ test_when_finished "rm one" &&
+ test_when_finished "rmdir top-level-dir" &&
+ >one &&
+ mkdir top-level-dir &&
+ git check-ignore one top-level-dir >actual &&
+ grep one actual &&
+ grep top-level-dir actual
+'
+
+test_expect_success 'existing directory and file' '
+ test_when_finished "rm one" &&
+ test_when_finished "rmdir top-level-dir" &&
+ >one &&
+ mkdir top-level-dir &&
+ git check-ignore top-level-dir one >actual &&
+ grep one actual &&
+ grep top-level-dir actual
+'
+
############################################################################
#
# test whitespace handling