3 test_description='"git merge" top-level frontend'
8 git checkout -B master two &&
9 git branch -f left three &&
10 git branch -f right four
13 test_expect_success setup '
27 test_expect_success 'merge an octopus into void' '
29 git checkout --orphan test &&
31 test_must_fail git merge left right &&
32 test_must_fail git rev-parse --verify HEAD &&
34 test_must_fail git rev-parse HEAD
37 test_expect_success 'merge an octopus, fast-forward (ff)' '
39 git reset --hard one &&
40 git merge left right &&
41 # one is ancestor of three (left) and four (right)
42 test_must_fail git rev-parse --verify HEAD^3 &&
43 git rev-parse HEAD^1 HEAD^2 | sort >actual &&
44 git rev-parse three four | sort >expect &&
45 test_cmp expect actual
48 test_expect_success 'merge octopus, non-fast-forward (ff)' '
50 git reset --hard one &&
51 git merge --no-ff left right &&
52 # one is ancestor of three (left) and four (right)
53 test_must_fail git rev-parse --verify HEAD^4 &&
54 git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
55 git rev-parse one three four | sort >expect &&
56 test_cmp expect actual
59 test_expect_success 'merge octopus, fast-forward (does not ff)' '
61 git merge left right &&
62 # two (master) is not an ancestor of three (left) and four (right)
63 test_must_fail git rev-parse --verify HEAD^4 &&
64 git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
65 git rev-parse two three four | sort >expect &&
66 test_cmp expect actual
69 test_expect_success 'merge octopus, non-fast-forward' '
71 git merge --no-ff left right &&
72 test_must_fail git rev-parse --verify HEAD^4 &&
73 git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
74 git rev-parse two three four | sort >expect &&
75 test_cmp expect actual
78 # The same set with FETCH_HEAD
80 test_expect_success 'merge FETCH_HEAD octopus into void' '
82 git checkout --orphan test &&
84 git fetch . left right &&
85 test_must_fail git merge FETCH_HEAD &&
86 test_must_fail git rev-parse --verify HEAD &&
88 test_must_fail git rev-parse HEAD
91 test_expect_success 'merge FETCH_HEAD octopus fast-forward (ff)' '
93 git reset --hard one &&
94 git fetch . left right &&
95 git merge FETCH_HEAD &&
96 # one is ancestor of three (left) and four (right)
97 test_must_fail git rev-parse --verify HEAD^3 &&
98 git rev-parse HEAD^1 HEAD^2 | sort >actual &&
99 git rev-parse three four | sort >expect &&
100 test_cmp expect actual
103 test_expect_success 'merge FETCH_HEAD octopus non-fast-forward (ff)' '
105 git reset --hard one &&
106 git fetch . left right &&
107 git merge --no-ff FETCH_HEAD &&
108 # one is ancestor of three (left) and four (right)
109 test_must_fail git rev-parse --verify HEAD^4 &&
110 git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
111 git rev-parse one three four | sort >expect &&
112 test_cmp expect actual
115 test_expect_success 'merge FETCH_HEAD octopus fast-forward (does not ff)' '
117 git fetch . left right &&
118 git merge FETCH_HEAD &&
119 # two (master) is not an ancestor of three (left) and four (right)
120 test_must_fail git rev-parse --verify HEAD^4 &&
121 git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
122 git rev-parse two three four | sort >expect &&
123 test_cmp expect actual
126 test_expect_success 'merge FETCH_HEAD octopus non-fast-forward' '
128 git fetch . left right &&
129 git merge --no-ff FETCH_HEAD &&
130 test_must_fail git rev-parse --verify HEAD^4 &&
131 git rev-parse HEAD^1 HEAD^2 HEAD^3 | sort >actual &&
132 git rev-parse two three four | sort >expect &&
133 test_cmp expect actual