Merge branch 'ab/send-email-catfile'
[git/kirr.git] / t / t7104-reset.sh
blobf136ee7bb5300966c0c3c9d2250dc81763db9feb
1 #!/bin/sh
3 test_description='reset --hard unmerged'
5 . ./test-lib.sh
7 test_expect_success setup '
9 mkdir before later &&
10 >before/1 &&
11 >before/2 &&
12 >hello &&
13 >later/3 &&
14 git add before hello later &&
15 git commit -m world &&
17 H=$(git rev-parse :hello) &&
18 git rm --cached hello &&
19 echo "100644 $H 2 hello" | git update-index --index-info &&
21 rm -f hello &&
22 mkdir -p hello &&
23 >hello/world &&
24 test "$(git ls-files -o)" = hello/world
28 test_expect_success 'reset --hard should restore unmerged ones' '
30 git reset --hard &&
31 git ls-files --error-unmatch before/1 before/2 hello later/3 &&
32 test -f hello
36 test_expect_success 'reset --hard did not corrupt index nor cached-tree' '
38 T=$(git write-tree) &&
39 rm -f .git/index &&
40 git add before hello later &&
41 U=$(git write-tree) &&
42 test "$T" = "$U"
46 test_done