3 # Copyright (c) 2006, Junio C Hamano
6 test_description='fmt-merge-msg test'
12 GIT_COMMITTER_DATE="$datestamp +0200"
13 GIT_AUTHOR_DATE="$datestamp +0200"
14 datestamp=`expr "$datestamp" + 1`
15 export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
18 test_expect_success setup '
22 git commit -m "Initial" &&
30 git commit -a -m "Second" &&
32 git checkout -b left &&
34 echo $datestamp >one &&
36 git commit -a -m "Common #1" &&
38 echo $datestamp >one &&
40 git commit -a -m "Common #2" &&
44 echo $datestamp >two &&
46 git commit -a -m "Left #3" &&
48 echo $datestamp >two &&
50 git commit -a -m "Left #4" &&
52 echo $datestamp >two &&
54 git commit -a -m "Left #5" &&
58 echo $datestamp >three &&
61 git commit -a -m "Right #3" &&
63 echo $datestamp >three &&
65 git commit -a -m "Right #4" &&
67 echo $datestamp >three &&
69 git commit -a -m "Right #5" &&
78 test_expect_success 'merge-msg test #1' '
80 git checkout master &&
83 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
84 test_cmp expected actual
88 Merge branch 'left' of $(pwd)
91 test_expect_success 'merge-msg test #2' '
93 git checkout master &&
94 git fetch "$(pwd)" left &&
96 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
97 test_cmp expected actual
111 test_expect_success 'merge-msg test #3-1' '
113 git config --unset-all merge.log
114 git config --unset-all merge.summary
115 git config merge.log true &&
117 git checkout master &&
121 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
122 test_cmp expected actual
125 test_expect_success 'merge-msg test #3-2' '
127 git config --unset-all merge.log
128 git config --unset-all merge.summary
129 git config merge.summary true &&
131 git checkout master &&
135 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
136 test_cmp expected actual
140 Merge branches 'left' and 'right'
157 test_expect_success 'merge-msg test #4-1' '
159 git config --unset-all merge.log
160 git config --unset-all merge.summary
161 git config merge.log true &&
163 git checkout master &&
165 git fetch . left right &&
167 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
168 test_cmp expected actual
171 test_expect_success 'merge-msg test #4-2' '
173 git config --unset-all merge.log
174 git config --unset-all merge.summary
175 git config merge.summary true &&
177 git checkout master &&
179 git fetch . left right &&
181 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
182 test_cmp expected actual
185 test_expect_success 'merge-msg test #5-1' '
187 git config --unset-all merge.log
188 git config --unset-all merge.summary
189 git config merge.log yes &&
191 git checkout master &&
193 git fetch . left right &&
195 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
196 test_cmp expected actual
199 test_expect_success 'merge-msg test #5-2' '
201 git config --unset-all merge.log
202 git config --unset-all merge.summary
203 git config merge.summary yes &&
205 git checkout master &&
207 git fetch . left right &&
209 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
210 test_cmp expected actual
213 test_expect_success 'merge-msg -F' '
215 git config --unset-all merge.log
216 git config --unset-all merge.summary
217 git config merge.summary yes &&
219 git checkout master &&
221 git fetch . left right &&
223 git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
224 test_cmp expected actual
227 test_expect_success 'merge-msg -F in subdirectory' '
229 git config --unset-all merge.log
230 git config --unset-all merge.summary
231 git config merge.summary yes &&
233 git checkout master &&
235 git fetch . left right &&
237 cp .git/FETCH_HEAD sub/FETCH_HEAD &&
240 git fmt-merge-msg -F FETCH_HEAD >../actual
242 test_cmp expected actual
245 test_expect_success 'merge-msg with nothing to merge' '
247 git config --unset-all merge.log
248 git config --unset-all merge.summary
249 git config merge.summary yes &&
253 git checkout -b unrelated &&
256 git fmt-merge-msg <.git/FETCH_HEAD >../actual
259 test_cmp /dev/null actual