]>
Commit | Line | Data |
---|---|---|
30a95f30 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006, Junio C Hamano | |
4 | # | |
5 | ||
6 | test_description='fmt-merge-msg test' | |
7 | ||
8 | . ./test-lib.sh | |
9 | ||
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 | |
16 | } | |
17 | ||
18 | test_expect_success setup ' | |
19 | echo one >one && | |
20 | git add one && | |
21 | setdate && | |
22 | git commit -m "Initial" && | |
23 | ||
24 | echo uno >one && | |
25 | echo dos >two && | |
26 | git add two && | |
27 | setdate && | |
28 | git commit -a -m "Second" && | |
29 | ||
30 | git checkout -b left && | |
31 | ||
32 | echo $datestamp >one && | |
33 | setdate && | |
34 | git commit -a -m "Common #1" && | |
35 | ||
36 | echo $datestamp >one && | |
37 | setdate && | |
38 | git commit -a -m "Common #2" && | |
39 | ||
40 | git branch right && | |
41 | ||
42 | echo $datestamp >two && | |
43 | setdate && | |
44 | git commit -a -m "Left #3" && | |
45 | ||
46 | echo $datestamp >two && | |
47 | setdate && | |
48 | git commit -a -m "Left #4" && | |
49 | ||
50 | echo $datestamp >two && | |
51 | setdate && | |
52 | git commit -a -m "Left #5" && | |
53 | ||
54 | git checkout right && | |
55 | ||
56 | echo $datestamp >three && | |
57 | git add three && | |
58 | setdate && | |
59 | git commit -a -m "Right #3" && | |
60 | ||
61 | echo $datestamp >three && | |
62 | setdate && | |
63 | git commit -a -m "Right #4" && | |
64 | ||
65 | echo $datestamp >three && | |
66 | setdate && | |
67 | git commit -a -m "Right #5" && | |
68 | ||
69 | git show-branch | |
70 | ' | |
71 | ||
72 | cat >expected <<\EOF | |
73 | Merge branch 'left' | |
74 | EOF | |
75 | ||
76 | test_expect_success 'merge-msg test #1' ' | |
77 | ||
78 | git checkout master && | |
79 | git fetch . left && | |
80 | ||
81 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 82 | test_cmp expected actual |
30a95f30 JH |
83 | ' |
84 | ||
4a7aaccd BD |
85 | cat >expected <<EOF |
86 | Merge branch 'left' of ../$test | |
30a95f30 JH |
87 | EOF |
88 | ||
89 | test_expect_success 'merge-msg test #2' ' | |
90 | ||
91 | git checkout master && | |
4a7aaccd | 92 | git fetch ../"$test" left && |
30a95f30 JH |
93 | |
94 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 95 | test_cmp expected actual |
30a95f30 JH |
96 | ' |
97 | ||
98 | cat >expected <<\EOF | |
99 | Merge branch 'left' | |
100 | ||
101 | * left: | |
102 | Left #5 | |
103 | Left #4 | |
104 | Left #3 | |
105 | Common #2 | |
106 | Common #1 | |
107 | EOF | |
108 | ||
6cd9cfef | 109 | test_expect_success 'merge-msg test #3-1' ' |
30a95f30 | 110 | |
6cd9cfef SG |
111 | git config --unset-all merge.log |
112 | git config --unset-all merge.summary | |
113 | git config merge.log true && | |
114 | ||
115 | git checkout master && | |
116 | setdate && | |
117 | git fetch . left && | |
118 | ||
119 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 120 | test_cmp expected actual |
6cd9cfef SG |
121 | ' |
122 | ||
123 | test_expect_success 'merge-msg test #3-2' ' | |
124 | ||
125 | git config --unset-all merge.log | |
126 | git config --unset-all merge.summary | |
e0d10e1c | 127 | git config merge.summary true && |
30a95f30 JH |
128 | |
129 | git checkout master && | |
130 | setdate && | |
131 | git fetch . left && | |
132 | ||
133 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 134 | test_cmp expected actual |
30a95f30 JH |
135 | ' |
136 | ||
137 | cat >expected <<\EOF | |
138 | Merge branches 'left' and 'right' | |
139 | ||
140 | * left: | |
141 | Left #5 | |
142 | Left #4 | |
143 | Left #3 | |
144 | Common #2 | |
145 | Common #1 | |
146 | ||
147 | * right: | |
148 | Right #5 | |
149 | Right #4 | |
150 | Right #3 | |
151 | Common #2 | |
152 | Common #1 | |
153 | EOF | |
154 | ||
6cd9cfef SG |
155 | test_expect_success 'merge-msg test #4-1' ' |
156 | ||
157 | git config --unset-all merge.log | |
158 | git config --unset-all merge.summary | |
159 | git config merge.log true && | |
160 | ||
161 | git checkout master && | |
162 | setdate && | |
163 | git fetch . left right && | |
164 | ||
165 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 166 | test_cmp expected actual |
6cd9cfef SG |
167 | ' |
168 | ||
169 | test_expect_success 'merge-msg test #4-2' ' | |
30a95f30 | 170 | |
6cd9cfef SG |
171 | git config --unset-all merge.log |
172 | git config --unset-all merge.summary | |
e0d10e1c | 173 | git config merge.summary true && |
30a95f30 JH |
174 | |
175 | git checkout master && | |
176 | setdate && | |
177 | git fetch . left right && | |
178 | ||
179 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 180 | test_cmp expected actual |
30a95f30 JH |
181 | ' |
182 | ||
6cd9cfef SG |
183 | test_expect_success 'merge-msg test #5-1' ' |
184 | ||
185 | git config --unset-all merge.log | |
186 | git config --unset-all merge.summary | |
187 | git config merge.log yes && | |
188 | ||
189 | git checkout master && | |
190 | setdate && | |
191 | git fetch . left right && | |
192 | ||
193 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 194 | test_cmp expected actual |
6cd9cfef SG |
195 | ' |
196 | ||
197 | test_expect_success 'merge-msg test #5-2' ' | |
30a95f30 | 198 | |
6cd9cfef SG |
199 | git config --unset-all merge.log |
200 | git config --unset-all merge.summary | |
e0d10e1c | 201 | git config merge.summary yes && |
30a95f30 JH |
202 | |
203 | git checkout master && | |
204 | setdate && | |
205 | git fetch . left right && | |
206 | ||
207 | git fmt-merge-msg <.git/FETCH_HEAD >actual && | |
3af82863 | 208 | test_cmp expected actual |
30a95f30 JH |
209 | ' |
210 | ||
211 | test_done |