Merge branch 'ds/mailmap'
[git/debian.git] / t / t1420-lost-found.sh
blobdbe15a0be1051608c4dc6dd727e1589e9422b7b5
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description='Test fsck --lost-found'
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
11 test_expect_success setup '
12 git config core.logAllRefUpdates 0 &&
13 : > file1 &&
14 git add file1 &&
15 test_tick &&
16 git commit -m initial &&
17 echo 1 > file1 &&
18 echo 2 > file2 &&
19 git add file1 file2 &&
20 test_tick &&
21 git commit -m second &&
22 echo 3 > file3 &&
23 git add file3
26 test_expect_success 'lost and found something' '
27 git rev-parse HEAD > lost-commit &&
28 git rev-parse :file3 > lost-other &&
29 test_tick &&
30 git reset --hard HEAD^ &&
31 git fsck --lost-found &&
32 test 2 = $(ls .git/lost-found/*/* | wc -l) &&
33 test -f .git/lost-found/commit/$(cat lost-commit) &&
34 test -f .git/lost-found/other/$(cat lost-other)
37 test_done