tests: rename work-tree tests to *work-tree*
[git/git-svn.git] / t / t3033-merge-toplevel.sh
blob46aadc410bc470d9279ed1fd3ee72583d0963d30
1 #!/bin/sh
3 test_description='"git merge" top-level frontend'
5 . ./test-lib.sh
7 t3033_reset () {
8 git checkout -B master two &&
9 git branch -f left three &&
10 git branch -f right four
13 test_expect_success setup '
14 test_commit one &&
15 git branch left &&
16 git branch right &&
17 test_commit two &&
18 git checkout left &&
19 test_commit three &&
20 git checkout right &&
21 test_commit four &&
22 git checkout master
25 # Local branches
27 test_expect_success 'merge an octopus into void' '
28 t3033_reset &&
29 git checkout --orphan test &&
30 git rm -fr . &&
31 test_must_fail git merge left right &&
32 test_must_fail git rev-parse --verify HEAD &&
33 git diff --quiet &&
34 test_must_fail git rev-parse HEAD
37 test_expect_success 'merge an octopus, fast-forward (ff)' '
38 t3033_reset &&
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)' '
49 t3033_reset &&
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)' '
60 t3033_reset &&
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' '
70 t3033_reset &&
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' '
81 t3033_reset &&
82 git checkout --orphan test &&
83 git rm -fr . &&
84 git fetch . left right &&
85 test_must_fail git merge FETCH_HEAD &&
86 test_must_fail git rev-parse --verify HEAD &&
87 git diff --quiet &&
88 test_must_fail git rev-parse HEAD
91 test_expect_success 'merge FETCH_HEAD octopus fast-forward (ff)' '
92 t3033_reset &&
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)' '
104 t3033_reset &&
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)' '
116 t3033_reset &&
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' '
127 t3033_reset &&
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
136 test_done