Skip to content

Commit 8c8884c

Browse files
Awaryngitster
authored andcommitted
t4150-am: refactor am -3 tests
Create a setup for git am -3 in a separate test instead of creating this setup each time. This prepares for the next commit which will use this setup as well. Signed-off-by: Remi Lespinet <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1164db9 commit 8c8884c

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

t/t4150-am.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
274274
grep "^\[foo\] third" actual
275275
'
276276

277-
test_expect_success 'am -3 falls back to 3-way merge' '
277+
test_expect_success 'setup am -3' '
278278
rm -fr .git/rebase-apply &&
279279
git reset --hard &&
280-
git checkout -b lorem2 master2 &&
280+
git checkout -b base3way master2 &&
281281
sed -n -e "3,\$p" msg >file &&
282282
head -n 9 msg >>file &&
283283
git add file &&
284284
test_tick &&
285-
git commit -m "copied stuff" &&
285+
git commit -m "copied stuff"
286+
'
287+
288+
test_expect_success 'am -3 falls back to 3-way merge' '
289+
rm -fr .git/rebase-apply &&
290+
git reset --hard &&
291+
git checkout -b lorem2 base3way &&
286292
git am -3 lorem-move.patch &&
287293
test_path_is_missing .git/rebase-apply &&
288294
git diff --exit-code lorem
@@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' '
291297
test_expect_success 'am -3 -p0 can read --no-prefix patch' '
292298
rm -fr .git/rebase-apply &&
293299
git reset --hard &&
294-
git checkout -b lorem3 master2 &&
295-
sed -n -e "3,\$p" msg >file &&
296-
head -n 9 msg >>file &&
297-
git add file &&
298-
test_tick &&
299-
git commit -m "copied stuff" &&
300+
git checkout -b lorem3 base3way &&
300301
git am -3 -p0 lorem-zero.patch &&
301302
test_path_is_missing .git/rebase-apply &&
302303
git diff --exit-code lorem
@@ -338,12 +339,7 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge'
338339
test_expect_success 'am -3 -q is quiet' '
339340
rm -fr .git/rebase-apply &&
340341
git checkout -f lorem2 &&
341-
git reset master2 --hard &&
342-
sed -n -e "3,\$p" msg >file &&
343-
head -n 9 msg >>file &&
344-
git add file &&
345-
test_tick &&
346-
git commit -m "copied stuff" &&
342+
git reset base3way --hard &&
347343
git am -3 -q lorem-move.patch >output.out 2>&1 &&
348344
! test -s output.out
349345
'

0 commit comments

Comments
 (0)