ls-tree tests: add tests for --name-status

The --name-status synonym for --name-only added in
c639a5548a (ls-tree: --name-only, 2005-12-01) had no tests, let's
make sure it works the same way as its sibling.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2022-03-23 17:13:01 +08:00
committed by Junio C Hamano
parent cd3e606211
commit a53343e0fd

View File

@ -201,31 +201,34 @@ EOF
test_cmp expected check test_cmp expected check
' '
test_expect_success 'ls-tree --name-only' ' for opt in --name-only --name-status
git ls-tree --name-only $tree >current && do
cat >expected <<\EOF && test_expect_success "ls-tree $opt" '
1.txt git ls-tree $opt $tree >current &&
2.txt cat >expected <<-\EOF &&
path0 1.txt
path1 2.txt
path2 path0
path3 path1
EOF path2
test_output path3
' EOF
test_output
'
test_expect_success 'ls-tree --name-only -r' ' test_expect_success "ls-tree $opt -r" '
git ls-tree --name-only -r $tree >current && git ls-tree $opt -r $tree >current &&
cat >expected <<\EOF && cat >expected <<-\EOF &&
1.txt 1.txt
2.txt 2.txt
path0/a/b/c/1.txt path0/a/b/c/1.txt
path1/b/c/1.txt path1/b/c/1.txt
path2/1.txt path2/1.txt
path3/1.txt path3/1.txt
path3/2.txt path3/2.txt
EOF EOF
test_output test_output
' '
done
test_done test_done