]>
git.ipfire.org Git - thirdparty/git.git/blob - t/t7111-reset-table.sh
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
75 test_expect_success
'setting up branches to test with unmerged entries' '
79 git checkout branch1 &&
80 test_commit B1 file1 &&
81 git checkout branch2 &&
85 while read W1 I1 H1 T opt W2 I2 H2
87 test_expect_success
"check: $W1 $I1 $H1 $T --$opt $W2 $I2 $H2" '
89 test_must_fail git merge branch1 &&
91 if test "$W2" != "XXXXX"
93 git reset --$opt $T &&
96 test_cmp file1 X_file1
98 test "$(cat file1)" = "$W2"
100 git checkout-index -f -- file1 &&
101 test "$(cat file1)" = "$I2" &&
102 git checkout -f HEAD -- file1 &&
103 test "$(cat file1)" = "$H2"
105 test_must_fail git reset --$opt $T