t1420: modernize the lost-found test

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>

Andrew Chitester committed Jan 6, 2026 at 08:26 UTC 6c5c7e7071eeac33139fc7a7c0387bfb981153c2
1 file changed +6 -3
t/t1420-lost-found.sh
+6 -3
@@ -28,9 +28,12 @@ test_expect_success 'lost and found something' '
28 test_tick &&
29 git reset --hard HEAD^ &&
30 git fsck --lost-found &&
31 - test 2 = $(ls .git/lost-found/*/* | wc -l) &&
32 - test -f .git/lost-found/commit/$(cat lost-commit) &&
33 - test -f .git/lost-found/other/$(cat lost-other)
31 + ls .git/lost-found/*/* >actual &&
32 + cat >expect <<-EOF &&
33 + .git/lost-found/commit/$(cat lost-commit)
34 + .git/lost-found/other/$(cat lost-other)
35 + EOF
36 + test_cmp expect actual
37 '
38
39 test_done