summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>2015-06-04 17:04:54 +0200
committerJunio C Hamano <gitster@pobox.com>2015-06-04 10:39:47 -0700
commit8c8884ce97eed5ab27a8b6f9f54a6f3795eded19 (patch)
tree3637a389cf200a098bcb489b2ea7710d85faf2bb
parent1164db977e3c2dd54a4d90d4aded7ca64791d16b (diff)
downloadgit-8c8884ce97eed5ab27a8b6f9f54a6f3795eded19.tar.gz
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 <remi.lespinet@ensimag.grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t4150-am.sh26
1 files changed, 11 insertions, 15 deletions
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 306e6f39ac..6ced98cfb4 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
grep "^\[foo\] third" actual
'
-test_expect_success 'am -3 falls back to 3-way merge' '
+test_expect_success 'setup am -3' '
rm -fr .git/rebase-apply &&
git reset --hard &&
- git checkout -b lorem2 master2 &&
+ git checkout -b base3way master2 &&
sed -n -e "3,\$p" msg >file &&
head -n 9 msg >>file &&
git add file &&
test_tick &&
- git commit -m "copied stuff" &&
+ git commit -m "copied stuff"
+'
+
+test_expect_success 'am -3 falls back to 3-way merge' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout -b lorem2 base3way &&
git am -3 lorem-move.patch &&
test_path_is_missing .git/rebase-apply &&
git diff --exit-code lorem
@@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' '
test_expect_success 'am -3 -p0 can read --no-prefix patch' '
rm -fr .git/rebase-apply &&
git reset --hard &&
- git checkout -b lorem3 master2 &&
- sed -n -e "3,\$p" msg >file &&
- head -n 9 msg >>file &&
- git add file &&
- test_tick &&
- git commit -m "copied stuff" &&
+ git checkout -b lorem3 base3way &&
git am -3 -p0 lorem-zero.patch &&
test_path_is_missing .git/rebase-apply &&
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'
test_expect_success 'am -3 -q is quiet' '
rm -fr .git/rebase-apply &&
git checkout -f lorem2 &&
- git reset master2 --hard &&
- sed -n -e "3,\$p" msg >file &&
- head -n 9 msg >>file &&
- git add file &&
- test_tick &&
- git commit -m "copied stuff" &&
+ git reset base3way --hard &&
git am -3 -q lorem-move.patch >output.out 2>&1 &&
! test -s output.out
'