3 # Copyright (c) 2010 Christian Couder
6 test_description
='Tests to check that "reset" options follow a known table'
8 TEST_PASSES_SANITIZE_LEAK
=true
12 test_expect_success
'creating initial commits' '
13 test_commit E file1 &&
14 test_commit D file1 &&
18 while read W1 I1 H1 T opt W2 I2 H2
20 test_expect_success
"check: $W1 $I1 $H1 $T --$opt $W2 $I2 $H2" '
22 if test "$I1" != "$H1"
27 if test "$W1" != "$I1"
31 if test "$W2" != "XXXXX"
33 git reset --$opt $T &&
34 test "$(cat file1)" = "$W2" &&
35 git checkout-index -f -- file1 &&
36 test "$(cat file1)" = "$I2" &&
37 git checkout -f HEAD -- file1 &&
38 test "$(cat file1)" = "$H2"
40 test_must_fail git reset --$opt $T
76 test_expect_success
'setting up branches to test with unmerged entries' '
80 git checkout branch1 &&
81 test_commit B1 file1 &&
82 git checkout branch2 &&
86 while read W1 I1 H1 T opt W2 I2 H2
88 test_expect_success
"check: $W1 $I1 $H1 $T --$opt $W2 $I2 $H2" '
90 test_must_fail git merge branch1 &&
92 if test "$W2" != "XXXXX"
94 git reset --$opt $T &&
97 test_cmp file1 X_file1
99 test "$(cat file1)" = "$W2"
101 git checkout-index -f -- file1 &&
102 test "$(cat file1)" = "$I2" &&
103 git checkout -f HEAD -- file1 &&
104 test "$(cat file1)" = "$H2"
106 test_must_fail git reset --$opt $T