3 test_description
="merges with unrelated index changes"
7 # Testcase for some simple merges
16 # Commit A: some file a
17 # Commit B: adds file b, modifies end of a
18 # Commit C: adds file c
19 # Commit D: adds file d, modifies beginning of a
20 # Commit E: renames a->subdir/a, adds subdir/e
22 test_expect_success
'setup trivial merges' '
25 test_tick && git commit -m A &&
37 test_tick && git commit -m B &&
42 test_tick && git commit -m C &&
48 test_tick && git commit -m D &&
55 test_tick && git commit -m E
58 test_expect_success
'ff update' '
62 touch random_file && git add random_file &&
66 test_must_fail git rev-parse HEAD:random_file &&
67 test "$(git diff --name-only --cached E)" = "random_file"
70 test_expect_success
'ff update, important file modified' '
78 test_must_fail git merge E^0
81 test_expect_success
'resolve, trivial' '
85 touch random_file && git add random_file &&
87 test_must_fail git merge -s resolve C^0
90 test_expect_success
'resolve, non-trivial' '
94 touch random_file && git add random_file &&
96 test_must_fail git merge -s resolve D^0
99 test_expect_success
'recursive' '
103 touch random_file && git add random_file &&
105 test_must_fail git merge -s recursive C^0
108 test_expect_success
'octopus, unrelated file touched' '
112 touch random_file && git add random_file &&
114 test_must_fail git merge C^0 D^0
117 test_expect_success
'octopus, related file removed' '
123 test_must_fail git merge C^0 D^0
126 test_expect_success
'octopus, related file modified' '
130 echo 12 >>a && git add a &&
132 test_must_fail git merge C^0 D^0
135 test_expect_success
'ours' '
139 touch random_file && git add random_file &&
141 test_must_fail git merge -s ours C^0
144 test_expect_success
'subtree' '
148 touch random_file && git add random_file &&
150 test_must_fail git merge -s subtree E^0