Skip to content

Commit a61ba26

Browse files
committed
test: "am -3" can accept non-standard -p<num>
This adds a test for the previous one to make sure that "am -3 -p0" can read patches created with the --no-prefix option. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4056afb commit a61ba26

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

t/t4150-am.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ test_expect_success setup '
123123
git commit -m "added another file" &&
124124
125125
git format-patch --stdout master >lorem-move.patch &&
126+
git format-patch --no-prefix --stdout master >lorem-zero.patch &&
126127
127128
git checkout -b rename &&
128129
git mv file renamed &&
@@ -276,6 +277,20 @@ test_expect_success 'am -3 falls back to 3-way merge' '
276277
git diff --exit-code lorem
277278
'
278279

280+
test_expect_success 'am -3 -p0 can read --no-prefix patch' '
281+
rm -fr .git/rebase-apply &&
282+
git reset --hard &&
283+
git checkout -b lorem3 master2 &&
284+
sed -n -e "3,\$p" msg >file &&
285+
head -n 9 msg >>file &&
286+
git add file &&
287+
test_tick &&
288+
git commit -m "copied stuff" &&
289+
git am -3 -p0 lorem-zero.patch &&
290+
! test -d .git/rebase-apply &&
291+
git diff --exit-code lorem
292+
'
293+
279294
test_expect_success 'am can rename a file' '
280295
grep "^rename from" rename.patch &&
281296
rm -fr .git/rebase-apply &&

0 commit comments

Comments
 (0)