]>
Commit | Line | Data |
---|---|---|
68f6c019 JS |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Johannes E. Schindelin | |
4 | # | |
5 | ||
6 | test_description='Test fsck --lost-found' | |
d96fb140 ÆAB |
7 | |
8 | TEST_PASSES_SANITIZE_LEAK=true | |
68f6c019 JS |
9 | . ./test-lib.sh |
10 | ||
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 | |
24 | ' | |
25 | ||
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) | |
35 | ' | |
36 | ||
37 | test_done |