worktree: stop being overly intimate with run_command() internals
[git.git] / t / t7104-reset-hard.sh
blobcf9697eba9a6aeb9579abe5b7b97b400aca8c7d0
1 #!/bin/sh
3 test_description='reset --hard unmerged'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
10 mkdir before later &&
11 >before/1 &&
12 >before/2 &&
13 >hello &&
14 >later/3 &&
15 git add before hello later &&
16 git commit -m world &&
18 H=$(git rev-parse :hello) &&
19 git rm --cached hello &&
20 echo "100644 $H 2 hello" | git update-index --index-info &&
22 rm -f hello &&
23 mkdir -p hello &&
24 >hello/world &&
25 test "$(git ls-files -o)" = hello/world
29 test_expect_success 'reset --hard should restore unmerged ones' '
31 git reset --hard &&
32 git ls-files --error-unmatch before/1 before/2 hello later/3 &&
33 test -f hello
37 test_expect_success 'reset --hard did not corrupt index or cache-tree' '
39 T=$(git write-tree) &&
40 rm -f .git/index &&
41 git add before hello later &&
42 U=$(git write-tree) &&
43 test "$T" = "$U"
47 test_done