]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1420: modernize the lost-found test
authorAndrew Chitester <andchi@fastmail.com>
Tue, 6 Jan 2026 13:26:58 +0000 (08:26 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Jan 2026 00:19:41 +0000 (09:19 +0900)
This test indirectly checks that the lost-found folder has 2 files in it
and then checks that the expected two files exist. Make this more
deliberate by removing the old test -f and compare the actual ls of the
lost-found directory with the expected files.

Signed-off-by: Andrew Chitester <andchi@fastmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1420-lost-found.sh

index 2fb2f44f021ea36eb2f1601ba07974a041f19661..926c6d63e392dbf544f1f63ebceb06bff87f4a52 100755 (executable)
@@ -28,9 +28,12 @@ test_expect_success 'lost and found something' '
        test_tick &&
        git reset --hard HEAD^ &&
        git fsck --lost-found &&
-       test 2 = $(ls .git/lost-found/*/* | wc -l) &&
-       test -f .git/lost-found/commit/$(cat lost-commit) &&
-       test -f .git/lost-found/other/$(cat lost-other)
+       ls .git/lost-found/*/* >actual &&
+       cat >expect <<-EOF &&
+       .git/lost-found/commit/$(cat lost-commit)
+       .git/lost-found/other/$(cat lost-other)
+       EOF
+       test_cmp expect actual
 '
 
 test_done