@@ -122,6 +122,8 @@ test_expect_success setup '
122
122
'
123
123
124
124
test_expect_success ' am applies patch correctly' '
125
+ rm -fr .git/rebase-apply &&
126
+ git reset --hard &&
125
127
git checkout first &&
126
128
test_tick &&
127
129
git am <patch1 &&
@@ -132,6 +134,8 @@ test_expect_success 'am applies patch correctly' '
132
134
'
133
135
134
136
test_expect_success ' am applies patch e-mail not in a mbox' '
137
+ rm -fr .git/rebase-apply &&
138
+ git reset --hard &&
135
139
git checkout first &&
136
140
git am patch1.eml &&
137
141
! test -d .git/rebase-apply &&
@@ -141,6 +145,8 @@ test_expect_success 'am applies patch e-mail not in a mbox' '
141
145
'
142
146
143
147
test_expect_success ' am applies patch e-mail not in a mbox with CRLF' '
148
+ rm -fr .git/rebase-apply &&
149
+ git reset --hard &&
144
150
git checkout first &&
145
151
git am patch1-crlf.eml &&
146
152
! test -d .git/rebase-apply &&
@@ -165,6 +171,8 @@ compare () {
165
171
166
172
test_expect_success ' am changes committer and keeps author' '
167
173
test_tick &&
174
+ rm -fr .git/rebase-apply &&
175
+ git reset --hard &&
168
176
git checkout first &&
169
177
git am patch2 &&
170
178
! test -d .git/rebase-apply &&
@@ -178,6 +186,8 @@ test_expect_success 'am changes committer and keeps author' '
178
186
'
179
187
180
188
test_expect_success ' am --signoff adds Signed-off-by: line' '
189
+ rm -fr .git/rebase-apply &&
190
+ git reset --hard &&
181
191
git checkout -b master2 first &&
182
192
git am --signoff <patch2 &&
183
193
printf "%s\n" "$signoff" >expected &&
@@ -198,6 +208,8 @@ test_expect_success 'am stays in branch' '
198
208
test_expect_success ' am --signoff does not add Signed-off-by: line if already there' '
199
209
git format-patch --stdout HEAD^ >patch3 &&
200
210
sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2," patch3 >patch4
211
+ rm -fr .git/rebase-apply &&
212
+ git reset --hard &&
201
213
git checkout HEAD^ &&
202
214
git am --signoff patch4 &&
203
215
git cat-file commit HEAD >actual &&
@@ -211,6 +223,8 @@ test_expect_success 'am without --keep removes Re: and [PATCH] stuff' '
211
223
'
212
224
213
225
test_expect_success ' am --keep really keeps the subject' '
226
+ rm -fr .git/rebase-apply &&
227
+ git reset --hard &&
214
228
git checkout HEAD^ &&
215
229
git am --keep patch4 &&
216
230
! test -d .git/rebase-apply &&
@@ -219,6 +233,8 @@ test_expect_success 'am --keep really keeps the subject' '
219
233
'
220
234
221
235
test_expect_success ' am -3 falls back to 3-way merge' '
236
+ rm -fr .git/rebase-apply &&
237
+ git reset --hard &&
222
238
git checkout -b lorem2 master2 &&
223
239
sed -n -e "3,\$p" msg >file &&
224
240
head -n 9 msg >>file &&
@@ -231,6 +247,7 @@ test_expect_success 'am -3 falls back to 3-way merge' '
231
247
'
232
248
233
249
test_expect_success ' am -3 -q is quiet' '
250
+ rm -fr .git/rebase-apply &&
234
251
git reset master2 --hard &&
235
252
sed -n -e "3,\$p" msg >file &&
236
253
head -n 9 msg >>file &&
@@ -242,6 +259,8 @@ test_expect_success 'am -3 -q is quiet' '
242
259
'
243
260
244
261
test_expect_success ' am pauses on conflict' '
262
+ rm -fr .git/rebase-apply &&
263
+ git reset --hard &&
245
264
git checkout lorem2^^ &&
246
265
test_must_fail git am lorem-move.patch &&
247
266
test -d .git/rebase-apply
@@ -257,6 +276,8 @@ test_expect_success 'am --skip works' '
257
276
258
277
test_expect_success ' am --resolved works' '
259
278
echo goodbye >expected &&
279
+ rm -fr .git/rebase-apply &&
280
+ git reset --hard &&
260
281
git checkout lorem2^^ &&
261
282
test_must_fail git am lorem-move.patch &&
262
283
test -d .git/rebase-apply &&
@@ -268,18 +289,25 @@ test_expect_success 'am --resolved works' '
268
289
'
269
290
270
291
test_expect_success ' am takes patches from a Pine mailbox' '
292
+ rm -fr .git/rebase-apply &&
293
+ git reset --hard &&
271
294
git checkout first &&
272
295
cat pine patch1 | git am &&
273
296
! test -d .git/rebase-apply &&
274
297
git diff --exit-code master^..HEAD
275
298
'
276
299
277
300
test_expect_success ' am fails on mail without patch' '
301
+ rm -fr .git/rebase-apply &&
302
+ git reset --hard &&
278
303
test_must_fail git am <failmail &&
279
- rm -r .git/rebase-apply/
304
+ git am --abort &&
305
+ ! test -d .git/rebase-apply
280
306
'
281
307
282
308
test_expect_success ' am fails on empty patch' '
309
+ rm -fr .git/rebase-apply &&
310
+ git reset --hard &&
283
311
echo "---" >>failmail &&
284
312
test_must_fail git am <failmail &&
285
313
git am --skip &&
@@ -288,6 +316,8 @@ test_expect_success 'am fails on empty patch' '
288
316
289
317
test_expect_success ' am works from stdin in subdirectory' '
290
318
rm -fr subdir &&
319
+ rm -fr .git/rebase-apply &&
320
+ git reset --hard &&
291
321
git checkout first &&
292
322
(
293
323
mkdir -p subdir &&
@@ -299,6 +329,8 @@ test_expect_success 'am works from stdin in subdirectory' '
299
329
300
330
test_expect_success ' am works from file (relative path given) in subdirectory' '
301
331
rm -fr subdir &&
332
+ rm -fr .git/rebase-apply &&
333
+ git reset --hard &&
302
334
git checkout first &&
303
335
(
304
336
mkdir -p subdir &&
@@ -310,6 +342,8 @@ test_expect_success 'am works from file (relative path given) in subdirectory' '
310
342
311
343
test_expect_success ' am works from file (absolute path given) in subdirectory' '
312
344
rm -fr subdir &&
345
+ rm -fr .git/rebase-apply &&
346
+ git reset --hard &&
313
347
git checkout first &&
314
348
P=$(pwd) &&
315
349
(
@@ -321,6 +355,8 @@ test_expect_success 'am works from file (absolute path given) in subdirectory' '
321
355
'
322
356
323
357
test_expect_success ' am --committer-date-is-author-date' '
358
+ rm -fr .git/rebase-apply &&
359
+ git reset --hard &&
324
360
git checkout first &&
325
361
test_tick &&
326
362
git am --committer-date-is-author-date patch1 &&
@@ -331,6 +367,8 @@ test_expect_success 'am --committer-date-is-author-date' '
331
367
'
332
368
333
369
test_expect_success ' am without --committer-date-is-author-date' '
370
+ rm -fr .git/rebase-apply &&
371
+ git reset --hard &&
334
372
git checkout first &&
335
373
test_tick &&
336
374
git am patch1 &&
@@ -345,6 +383,8 @@ test_expect_success 'am without --committer-date-is-author-date' '
345
383
# by test_tick that uses -0700 timezone; if this feature does not
346
384
# work, we will see that instead of +0000.
347
385
test_expect_success ' am --ignore-date' '
386
+ rm -fr .git/rebase-apply &&
387
+ git reset --hard &&
348
388
git checkout first &&
349
389
test_tick &&
350
390
git am --ignore-date patch1 &&
@@ -355,6 +395,8 @@ test_expect_success 'am --ignore-date' '
355
395
356
396
test_expect_success ' am into an unborn branch' '
357
397
git rev-parse first^{tree} >expected &&
398
+ rm -fr .git/rebase-apply &&
399
+ git reset --hard &&
358
400
rm -fr subdir &&
359
401
mkdir subdir &&
360
402
git format-patch --numbered-files -o subdir -1 first &&
@@ -371,6 +413,8 @@ test_expect_success 'am into an unborn branch' '
371
413
'
372
414
373
415
test_expect_success ' am newline in subject' '
416
+ rm -fr .git/rebase-apply &&
417
+ git reset --hard &&
374
418
git checkout first &&
375
419
test_tick &&
376
420
sed -e "s/second/second \\\n foo/" patch1 >patchnl &&
@@ -379,6 +423,8 @@ test_expect_success 'am newline in subject' '
379
423
'
380
424
381
425
test_expect_success ' am -q is quiet' '
426
+ rm -fr .git/rebase-apply &&
427
+ git reset --hard &&
382
428
git checkout first &&
383
429
test_tick &&
384
430
git am -q <patch1 >output.out 2>&1 &&
0 commit comments