зеркало из https://github.com/microsoft/git.git
t3000: add more testcases testing a variety of ls-files issues
This adds seven new ls-files tests. While currently all seven test pass, my earlier rounds of restructuring dir.c to replace an exponential algorithm with a linear one passed all the tests in the testsuite but failed six of these seven new tests. Add these tests to increase our case coverage. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
ce5c61a3f5
Коммит
7260c7b66e
|
@ -91,4 +91,125 @@ test_expect_success SYMLINKS 'ls-files --others with symlinked submodule' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'setup nested pathspec search' '
|
||||
test_create_repo nested &&
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
mkdir -p partially_tracked/untracked_dir &&
|
||||
> partially_tracked/content &&
|
||||
> partially_tracked/untracked_dir/file &&
|
||||
|
||||
mkdir -p untracked/deep &&
|
||||
> untracked/deep/path &&
|
||||
> untracked/deep/foo.c &&
|
||||
|
||||
git add partially_tracked/content
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ls-files -o --directory with single deep dir pathspec' '
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
git ls-files -o --directory untracked/deep/ >actual &&
|
||||
|
||||
cat <<-EOF >expect &&
|
||||
untracked/deep/
|
||||
EOF
|
||||
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ls-files -o --directory with multiple dir pathspecs' '
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
git ls-files -o --directory partially_tracked/ untracked/ >actual &&
|
||||
|
||||
cat <<-EOF >expect &&
|
||||
partially_tracked/untracked_dir/
|
||||
untracked/
|
||||
EOF
|
||||
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ls-files -o --directory with mix dir/file pathspecs' '
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
git ls-files -o --directory partially_tracked/ untracked/deep/path >actual &&
|
||||
|
||||
cat <<-EOF >expect &&
|
||||
partially_tracked/untracked_dir/
|
||||
untracked/deep/path
|
||||
EOF
|
||||
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ls-files --o --directory with glob filetype match' '
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
# globs kinda defeat --directory, but only for that pathspec
|
||||
git ls-files --others --directory partially_tracked "untracked/*.c" >actual &&
|
||||
|
||||
cat <<-EOF >expect &&
|
||||
partially_tracked/untracked_dir/
|
||||
untracked/deep/foo.c
|
||||
EOF
|
||||
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ls-files --o --directory with mix of tracked states' '
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
# globs kinda defeat --directory, but only for that pathspec
|
||||
git ls-files --others --directory partially_tracked/ "untracked/?*" >actual &&
|
||||
|
||||
cat <<-EOF >expect &&
|
||||
partially_tracked/untracked_dir/
|
||||
untracked/deep/
|
||||
EOF
|
||||
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ls-files --o --directory with glob filetype match only' '
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
git ls-files --others --directory "untracked/*.c" >actual &&
|
||||
|
||||
cat <<-EOF >expect &&
|
||||
untracked/deep/foo.c
|
||||
EOF
|
||||
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ls-files --o --directory to get immediate paths under one dir only' '
|
||||
(
|
||||
cd nested &&
|
||||
|
||||
git ls-files --others --directory "untracked/?*" >actual &&
|
||||
|
||||
cat <<-EOF >expect &&
|
||||
untracked/deep/
|
||||
EOF
|
||||
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче