t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length
Add a test to exercise the 'merge.log' configuration option of 'git fmt-merge-msg'. It controls the number of shortlog entries to display in merge commit messages. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Thanks-to: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Sep 8, 2010 at 23:29 UTC
b928cbf120a8f6d1d435849fb1fcf1c64489dc4c
1 file changed
+48
t/t6200-fmt-merge-msg.sh
+48
@@ -129,6 +129,54 @@ test_expect_success '[merge] summary/log configuration' '
129
test_cmp expected actual2
130
'
131
132
+test_expect_success 'setup: clear [merge] configuration' '
133
+ test_might_fail git config --unset-all merge.log &&
134
+ test_might_fail git config --unset-all merge.summary
135
+'
136
+
137
+test_expect_success 'setup FETCH_HEAD' '
138
+ git checkout master &&
139
+ test_tick &&
140
+ git fetch . left
141
+'
142
+
143
+test_expect_success 'merge.log=3 limits shortlog length' '
144
+ cat >expected <<-EOF &&
145
+ Merge branch ${apos}left${apos}
146
+
147
+ * left: (5 commits)
148
+ Left #5
149
+ Left #4
150
+ Left #3
151
+ ...
152
+ EOF
153
+
154
+ git -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >actual &&
155
+ test_cmp expected actual
156
+'
157
+
158
+test_expect_success 'merge.log=5 shows all 5 commits' '
159
+ cat >expected <<-EOF &&
160
+ Merge branch ${apos}left${apos}
161
+
162
+ * left:
163
+ Left #5
164
+ Left #4
165
+ Left #3
166
+ Common #2
167
+ Common #1
168
+ EOF
169
+
170
+ git -c merge.log=5 fmt-merge-msg <.git/FETCH_HEAD >actual &&
171
+ test_cmp expected actual
172
+'
173
+
174
+test_expect_success 'merge.log=0 disables shortlog' '
175
+ echo "Merge branch ${apos}left${apos}" >expected
176
+ git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
177
+ test_cmp expected actual
178
+'
179
+
180
test_expect_success 'fmt-merge-msg -m' '
181
echo "Sync with left" >expected &&
182
cat >expected.log <<-EOF &&