initial commit (same functionality as wingit)
[git/mingw/4msysgit/wingit-dll.git] / t / t6200-fmt-merge-msg.sh
blob512932ea2059c2ec77855dae9408a879b4b6501f
1 #!/bin/sh
3 # Copyright (c) 2006, Junio C Hamano
6 test_description='fmt-merge-msg test'
8 . ./test-lib.sh
10 datestamp=1151939923
11 setdate () {
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 '
19 echo one >one &&
20 git add one &&
21 setdate &&
22 git commit -m "Initial" &&
24 echo uno >one &&
25 echo dos >two &&
26 git add two &&
27 setdate &&
28 git commit -a -m "Second" &&
30 git checkout -b left &&
32 echo $datestamp >one &&
33 setdate &&
34 git commit -a -m "Common #1" &&
36 echo $datestamp >one &&
37 setdate &&
38 git commit -a -m "Common #2" &&
40 git branch right &&
42 echo $datestamp >two &&
43 setdate &&
44 git commit -a -m "Left #3" &&
46 echo $datestamp >two &&
47 setdate &&
48 git commit -a -m "Left #4" &&
50 echo $datestamp >two &&
51 setdate &&
52 git commit -a -m "Left #5" &&
54 git checkout right &&
56 echo $datestamp >three &&
57 git add three &&
58 setdate &&
59 git commit -a -m "Right #3" &&
61 echo $datestamp >three &&
62 setdate &&
63 git commit -a -m "Right #4" &&
65 echo $datestamp >three &&
66 setdate &&
67 git commit -a -m "Right #5" &&
69 git show-branch
72 cat >expected <<\EOF
73 Merge branch 'left'
74 EOF
76 test_expect_success 'merge-msg test #1' '
78 git checkout master &&
79 git fetch . left &&
81 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
82 test_cmp expected actual
85 TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd)
86 cat >expected <<EOF
87 Merge branch 'left' of $(pwd)
88 EOF
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
99 cat >expected <<\EOF
100 Merge branch 'left'
102 * left:
103 Left #5
104 Left #4
105 Left #3
106 Common #2
107 Common #1
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 &&
117 setdate &&
118 git fetch . left &&
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 &&
131 setdate &&
132 git fetch . left &&
134 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
135 test_cmp expected actual
138 cat >expected <<\EOF
139 Merge branches 'left' and 'right'
141 * left:
142 Left #5
143 Left #4
144 Left #3
145 Common #2
146 Common #1
148 * right:
149 Right #5
150 Right #4
151 Right #3
152 Common #2
153 Common #1
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 &&
163 setdate &&
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 &&
177 setdate &&
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 &&
191 setdate &&
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 &&
205 setdate &&
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 &&
219 setdate &&
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 &&
233 setdate &&
234 git fetch . left right &&
235 mkdir sub &&
236 cp .git/FETCH_HEAD sub/FETCH_HEAD &&
238 cd sub &&
239 git fmt-merge-msg -F FETCH_HEAD >../actual
240 ) &&
241 test_cmp expected actual
244 test_done