3 # Copyright (c) 2010 Christian Couder
6 test_description='Tests to check that "reset" options follow a known table'
11 test_expect_success 'creating initial commits' '
12 test_commit E file1 &&
13 test_commit D file1 &&
17 while read W1 I1 H1 T opt W2 I2 H2
19 test_expect_success "check: $W1 $I1 $H1 $T --$opt $W2 $I2 $H2" '
21 if test "$I1" != "$H1"
26 if test "$W1" != "$I1"
30 if test "$W2" != "XXXXX"
32 git reset --$opt $T &&
33 test "$(cat file1)" = "$W2" &&
34 git checkout-index -f -- file1 &&
35 test "$(cat file1)" = "$I2" &&
36 git checkout -f HEAD -- file1 &&
37 test "$(cat file1)" = "$H2"
39 test_must_fail git reset --$opt $T
69 test_expect_success 'setting up branches to test with unmerged entries' '
73 git checkout branch1 &&
74 test_commit B1 file1 &&
75 git checkout branch2 &&
79 while read W1 I1 H1 T opt W2 I2 H2
81 test_expect_success "check: $W1 $I1 $H1 $T --$opt $W2 $I2 $H2" '
83 test_must_fail git merge branch1 &&
85 if test "$W2" != "XXXXX"
87 git reset --$opt $T &&
90 test_cmp file1 X_file1
92 test "$(cat file1)" = "$W2"
94 git checkout-index -f -- file1 &&
95 test "$(cat file1)" = "$I2" &&
96 git checkout -f HEAD -- file1 &&
97 test "$(cat file1)" = "$H2"
99 test_must_fail git reset --$opt $T