]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ls-tree tests: add tests for --name-status
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 23 Mar 2022 09:13:01 +0000 (17:13 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Mar 2022 18:38:38 +0000 (11:38 -0700)
The --name-status synonym for --name-only added in
c639a5548a5 (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>
t/t3101-ls-tree-dirname.sh

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