3 # Copyright (c) 2006, Junio C Hamano
6 test_description='fmt-merge-msg test'
10 test_expect_success setup '
14 git commit -m "Initial" &&
22 git commit -a -m "Second" &&
24 git checkout -b left &&
28 git commit -a -m "Common #1" &&
32 git commit -a -m "Common #2" &&
38 git commit -a -m "Left #3" &&
42 git commit -a -m "Left #4" &&
46 git commit -a -m "Left #5" &&
54 git commit -a -m "Right #3" &&
59 git commit -a -m "Right #4" &&
63 git commit -a -m "Right #5" &&
72 test_expect_success 'merge-msg test #1' '
74 git checkout master &&
77 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
78 test_cmp expected actual
82 Merge branch 'left' of $(pwd)
85 test_expect_success 'merge-msg test #2' '
87 git checkout master &&
88 git fetch "$(pwd)" left &&
90 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
91 test_cmp expected actual
105 test_expect_success 'merge-msg test #3-1' '
107 git config --unset-all merge.log
108 git config --unset-all merge.summary
109 git config merge.log true &&
111 git checkout master &&
115 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
116 test_cmp expected actual
119 test_expect_success 'merge-msg test #3-2' '
121 git config --unset-all merge.log
122 git config --unset-all merge.summary
123 git config merge.summary true &&
125 git checkout master &&
129 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
130 test_cmp expected actual
134 Merge branches 'left' and 'right'
151 test_expect_success 'merge-msg test #4-1' '
153 git config --unset-all merge.log
154 git config --unset-all merge.summary
155 git config merge.log true &&
157 git checkout master &&
159 git fetch . left right &&
161 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
162 test_cmp expected actual
165 test_expect_success 'merge-msg test #4-2' '
167 git config --unset-all merge.log
168 git config --unset-all merge.summary
169 git config merge.summary true &&
171 git checkout master &&
173 git fetch . left right &&
175 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
176 test_cmp expected actual
179 test_expect_success 'merge-msg test #5-1' '
181 git config --unset-all merge.log
182 git config --unset-all merge.summary
183 git config merge.log yes &&
185 git checkout master &&
187 git fetch . left right &&
189 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
190 test_cmp expected actual
193 test_expect_success 'merge-msg test #5-2' '
195 git config --unset-all merge.log
196 git config --unset-all merge.summary
197 git config merge.summary yes &&
199 git checkout master &&
201 git fetch . left right &&
203 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
204 test_cmp expected actual
207 test_expect_success 'merge-msg -F' '
209 git config --unset-all merge.log
210 git config --unset-all merge.summary
211 git config merge.summary yes &&
213 git checkout master &&
215 git fetch . left right &&
217 git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
218 test_cmp expected actual
221 test_expect_success 'merge-msg -F in subdirectory' '
223 git config --unset-all merge.log
224 git config --unset-all merge.summary
225 git config merge.summary yes &&
227 git checkout master &&
229 git fetch . left right &&
231 cp .git/FETCH_HEAD sub/FETCH_HEAD &&
234 git fmt-merge-msg -F FETCH_HEAD >../actual
236 test_cmp expected actual
239 test_expect_success 'merge-msg with nothing to merge' '
241 git config --unset-all merge.log
242 git config --unset-all merge.summary
243 git config merge.summary yes &&
247 git checkout -b unrelated &&
250 git fmt-merge-msg <.git/FETCH_HEAD >../actual
253 test_cmp /dev/null actual