t4014: drop unnecessary blank lines from test cases
Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu committed
Aug 20, 2019 at 03:18 UTC
fe49814409cb2b3ab557964017c21526ae20726e
1 file changed
-47
t/t4014-format-patch.sh
-47
@@ -9,7 +9,6 @@ test_description='various format-patch tests'
9
. "$TEST_DIRECTORY"/lib-terminal.sh
10
11
test_expect_success setup '
12
-
12
for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file &&
13
cat file >elif &&
14
git add file elif &&
@@ -60,20 +59,16 @@ test_expect_success setup '
59
'
60
61
test_expect_success "format-patch --ignore-if-in-upstream" '
63
-
62
git format-patch --stdout master..side >patch0 &&
63
cnt=$(grep "^From " patch0 | wc -l) &&
64
test $cnt = 3
67
-
65
'
66
67
test_expect_success "format-patch --ignore-if-in-upstream" '
71
-
68
git format-patch --stdout \
69
--ignore-if-in-upstream master..side >patch1 &&
70
cnt=$(grep "^From " patch1 | wc -l) &&
71
test $cnt = 2
76
-
72
'
73
74
test_expect_success "format-patch --ignore-if-in-upstream handles tags" '
@@ -85,7 +80,6 @@ test_expect_success "format-patch --ignore-if-in-upstream handles tags" '
80
'
81
82
test_expect_success "format-patch doesn't consider merge commits" '
88
-
83
git checkout -b slave master &&
84
echo "Another line" >>file &&
85
test_tick &&
@@ -101,7 +95,6 @@ test_expect_success "format-patch doesn't consider merge commits" '
95
'
96
97
test_expect_success "format-patch result applies" '
104
-
98
git checkout -b rebuild-0 master &&
99
git am -3 patch0 &&
100
cnt=$(git rev-list master.. | wc -l) &&
@@ -109,7 +102,6 @@ test_expect_success "format-patch result applies" '
102
'
103
104
test_expect_success "format-patch --ignore-if-in-upstream result applies" '
112
-
105
git checkout -b rebuild-1 master &&
106
git am -3 patch1 &&
107
cnt=$(git rev-list master.. | wc -l) &&
@@ -117,26 +109,19 @@ test_expect_success "format-patch --ignore-if-in-upstream result applies" '
109
'
110
111
test_expect_success 'commit did not screw up the log message' '
120
-
112
git cat-file commit side | grep "^Side .* with .* backslash-n"
122
-
113
'
114
115
test_expect_success 'format-patch did not screw up the log message' '
126
-
116
grep "^Subject: .*Side changes #3 with .* backslash-n" patch0 &&
117
grep "^Subject: .*Side changes #3 with .* backslash-n" patch1
129
-
118
'
119
120
test_expect_success 'replay did not screw up the log message' '
133
-
121
git cat-file commit rebuild-1 | grep "^Side .* with .* backslash-n"
135
-
122
'
123
124
test_expect_success 'extra headers' '
139
-
125
git config format.headers "To: R E Cipient <rcipient@example.com>
126
" &&
127
git config --add format.headers "Cc: S E Cipient <scipient@example.com>
@@ -145,22 +130,18 @@ test_expect_success 'extra headers' '
130
sed -e "/^\$/q" patch2 > hdrs2 &&
131
grep "^To: R E Cipient <rcipient@example.com>\$" hdrs2 &&
132
grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs2
148
-
133
'
134
135
test_expect_success 'extra headers without newlines' '
152
-
136
git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" &&
137
git config --add format.headers "Cc: S E Cipient <scipient@example.com>" &&
138
git format-patch --stdout master..side >patch3 &&
139
sed -e "/^\$/q" patch3 > hdrs3 &&
140
grep "^To: R E Cipient <rcipient@example.com>\$" hdrs3 &&
141
grep "^Cc: S E Cipient <scipient@example.com>\$" hdrs3
159
-
142
'
143
144
test_expect_success 'extra headers with multiple To:s' '
163
-
145
git config --replace-all format.headers "To: R E Cipient <rcipient@example.com>" &&
146
git config --add format.headers "To: S E Cipient <scipient@example.com>" &&
147
git format-patch --stdout master..side > patch4 &&
@@ -170,7 +151,6 @@ test_expect_success 'extra headers with multiple To:s' '
151
'
152
153
test_expect_success 'additional command line cc (ascii)' '
173
-
154
git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
155
git format-patch --cc="S E Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
156
grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch5 &&
@@ -178,7 +158,6 @@ test_expect_success 'additional command line cc (ascii)' '
158
'
159
160
test_expect_failure 'additional command line cc (rfc822)' '
181
-
161
git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
162
git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
163
grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch5 &&
@@ -186,14 +165,12 @@ test_expect_failure 'additional command line cc (rfc822)' '
165
'
166
167
test_expect_success 'command line headers' '
189
-
168
git config --unset-all format.headers &&
169
git format-patch --add-header="Cc: R E Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch6 &&
170
grep "^Cc: R E Cipient <rcipient@example.com>\$" patch6
171
'
172
173
test_expect_success 'configuration headers and command line headers' '
196
-
174
git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
175
git format-patch --add-header="Cc: S E Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch7 &&
176
grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch7 &&
@@ -201,40 +178,34 @@ test_expect_success 'configuration headers and command line headers' '
178
'
179
180
test_expect_success 'command line To: header (ascii)' '
204
-
181
git config --unset-all format.headers &&
182
git format-patch --to="R E Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
183
grep "^To: R E Cipient <rcipient@example.com>\$" patch8
184
'
185
186
test_expect_failure 'command line To: header (rfc822)' '
211
-
187
git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
188
grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" patch8
189
'
190
191
test_expect_failure 'command line To: header (rfc2047)' '
217
-
192
git format-patch --to="R Ä Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
193
grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch8
194
'
195
196
test_expect_success 'configuration To: header (ascii)' '
223
-
197
git config format.to "R E Cipient <rcipient@example.com>" &&
198
git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
199
grep "^To: R E Cipient <rcipient@example.com>\$" patch9
200
'
201
202
test_expect_failure 'configuration To: header (rfc822)' '
230
-
203
git config format.to "R. E. Cipient <rcipient@example.com>" &&
204
git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
205
grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" patch9
206
'
207
208
test_expect_failure 'configuration To: header (rfc2047)' '
237
-
209
git config format.to "R Ä Cipient <rcipient@example.com>" &&
210
git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
211
grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch9
@@ -249,7 +220,6 @@ check_patch () {
220
}
221
222
test_expect_success 'format.from=false' '
252
-
223
git -c format.from=false format-patch --stdout master..side |
224
sed -e "/^\$/q" >patch &&
225
check_patch patch &&
@@ -257,7 +227,6 @@ test_expect_success 'format.from=false' '
227
'
228
229
test_expect_success 'format.from=true' '
260
-
230
git -c format.from=true format-patch --stdout master..side |
231
sed -e "/^\$/q" >patch &&
232
check_patch patch &&
@@ -265,7 +234,6 @@ test_expect_success 'format.from=true' '
234
'
235
236
test_expect_success 'format.from with address' '
268
-
237
git -c format.from="F R Om <from@example.com>" format-patch --stdout master..side |
238
sed -e "/^\$/q" >patch &&
239
check_patch patch &&
@@ -273,7 +241,6 @@ test_expect_success 'format.from with address' '
241
'
242
243
test_expect_success '--no-from overrides format.from' '
276
-
244
git -c format.from="F R Om <from@example.com>" format-patch --no-from --stdout master..side |
245
sed -e "/^\$/q" >patch &&
246
check_patch patch &&
@@ -281,7 +248,6 @@ test_expect_success '--no-from overrides format.from' '
248
'
249
250
test_expect_success '--from overrides format.from' '
284
-
251
git -c format.from="F R Om <from@example.com>" format-patch --from --stdout master..side |
252
sed -e "/^\$/q" >patch &&
253
check_patch patch &&
@@ -289,7 +255,6 @@ test_expect_success '--from overrides format.from' '
255
'
256
257
test_expect_success '--no-to overrides config.to' '
292
-
258
git config --replace-all format.to \
259
"R E Cipient <rcipient@example.com>" &&
260
git format-patch --no-to --stdout master..side |
@@ -299,7 +264,6 @@ test_expect_success '--no-to overrides config.to' '
264
'
265
266
test_expect_success '--no-to and --to replaces config.to' '
302
-
267
git config --replace-all format.to \
268
"Someone <someone@out.there>" &&
269
git format-patch --no-to --to="Someone Else <else@out.there>" \
@@ -311,7 +275,6 @@ test_expect_success '--no-to and --to replaces config.to' '
275
'
276
277
test_expect_success '--no-cc overrides config.cc' '
314
-
278
git config --replace-all format.cc \
279
"C E Cipient <rcipient@example.com>" &&
280
git format-patch --no-cc --stdout master..side |
@@ -321,7 +284,6 @@ test_expect_success '--no-cc overrides config.cc' '
284
'
285
286
test_expect_success '--no-add-header overrides config.headers' '
324
-
287
git config --replace-all format.headers \
288
"Header1: B E Cipient <rcipient@example.com>" &&
289
git format-patch --no-add-header --stdout master..side |
@@ -331,7 +293,6 @@ test_expect_success '--no-add-header overrides config.headers' '
293
'
294
295
test_expect_success 'multiple files' '
334
-
296
rm -rf patches/ &&
297
git checkout side &&
298
git format-patch -o patches/ master &&
@@ -594,7 +555,6 @@ test_expect_success 'thread config + --no-thread' '
555
'
556
557
test_expect_success 'excessive subject' '
597
-
558
rm -rf patches/ &&
559
git checkout side &&
560
before=$(git hash-object file) &&
@@ -622,7 +582,6 @@ test_expect_success 'cover-letter inherits diff options' '
582
! grep "file => foo .* 0 *\$" 0000-cover-letter.patch &&
583
git format-patch --cover-letter -1 -M &&
584
grep "file => foo .* 0 *\$" 0000-cover-letter.patch
625
-
585
'
586
587
cat > expect << EOF
@@ -636,11 +595,9 @@ cat > expect << EOF
595
EOF
596
597
test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
639
-
598
git format-patch --cover-letter -2 &&
599
sed -e "1,/A U Thor/d" -e "/^\$/q" < 0000-cover-letter.patch > output &&
600
test_cmp expect output
643
-
601
'
602
603
cat > expect << EOF
@@ -656,13 +613,11 @@ index $before..$after 100644
613
EOF
614
615
test_expect_success 'format-patch respects -U' '
659
-
616
git format-patch -U4 -2 &&
617
sed -e "1,/^diff/d" -e "/^+5/q" \
618
<0001-This-is-an-excessively-long-subject-line-for-a-messa.patch \
619
>output &&
620
test_cmp expect output
665
-
621
'
622
623
cat > expect << EOF
@@ -679,11 +634,9 @@ index $before..$after 100644
634
EOF
635
636
test_expect_success 'format-patch -p suppresses stat' '
682
-
637
git format-patch -p -2 &&
638
sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
639
test_cmp expect output
686
-
640
'
641
642
test_expect_success 'format-patch from a subdirectory (1)' '