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" &&
28 git commit -a -m "Second" &&
30 git checkout -b left &&
32 echo $datestamp >one &&
34 git commit -a -m "Common #1" &&
36 echo $datestamp >one &&
38 git commit -a -m "Common #2" &&
42 echo $datestamp >two &&
44 git commit -a -m "Left #3" &&
46 echo $datestamp >two &&
48 git commit -a -m "Left #4" &&
50 echo $datestamp >two &&
52 git commit -a -m "Left #5" &&
56 echo $datestamp >three &&
59 git commit -a -m "Right #3" &&
61 echo $datestamp >three &&
63 git commit -a -m "Right #4" &&
65 echo $datestamp >three &&
67 git commit -a -m "Right #5" &&
76 test_expect_success
'merge-msg test #1' '
78 git checkout master &&
81 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
82 test_cmp expected actual
85 TEST_DIRECTORY
=$
(cd "$TEST_DIRECTORY" && pwd)
87 Merge branch 'left' of $(pwd)
90 test_expect_success
'merge-msg test #2' '
92 git checkout master &&
93 git fetch "$(pwd)" left &&
95 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
96 test_cmp expected actual
110 test_expect_success
'merge-msg test #3-1' '
112 git config --unset-all merge.log
113 git config --unset-all merge.summary
114 git config merge.log true &&
116 git checkout master &&
120 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
121 test_cmp expected actual
124 test_expect_success
'merge-msg test #3-2' '
126 git config --unset-all merge.log
127 git config --unset-all merge.summary
128 git config merge.summary true &&
130 git checkout master &&
134 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
135 test_cmp expected actual
139 Merge branches
'left' and
'right'
156 test_expect_success
'merge-msg test #4-1' '
158 git config --unset-all merge.log
159 git config --unset-all merge.summary
160 git config merge.log true &&
162 git checkout master &&
164 git fetch . left right &&
166 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
167 test_cmp expected actual
170 test_expect_success
'merge-msg test #4-2' '
172 git config --unset-all merge.log
173 git config --unset-all merge.summary
174 git config merge.summary true &&
176 git checkout master &&
178 git fetch . left right &&
180 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
181 test_cmp expected actual
184 test_expect_success
'merge-msg test #5-1' '
186 git config --unset-all merge.log
187 git config --unset-all merge.summary
188 git config merge.log yes &&
190 git checkout master &&
192 git fetch . left right &&
194 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
195 test_cmp expected actual
198 test_expect_success
'merge-msg test #5-2' '
200 git config --unset-all merge.log
201 git config --unset-all merge.summary
202 git config merge.summary yes &&
204 git checkout master &&
206 git fetch . left right &&
208 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
209 test_cmp expected actual
212 test_expect_success
'merge-msg -F' '
214 git config --unset-all merge.log
215 git config --unset-all merge.summary
216 git config merge.summary yes &&
218 git checkout master &&
220 git fetch . left right &&
222 git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
223 test_cmp expected actual
226 test_expect_success
'merge-msg -F in subdirectory' '
228 git config --unset-all merge.log
229 git config --unset-all merge.summary
230 git config merge.summary yes &&
232 git checkout master &&
234 git fetch . left right &&
236 cp .git/FETCH_HEAD sub/FETCH_HEAD &&
239 git fmt-merge-msg -F FETCH_HEAD >../actual
241 test_cmp expected actual