summaryrefslogtreecommitdiff
path: root/t/t4150-am.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4150-am.sh')
-rwxr-xr-xt/t4150-am.sh68
1 files changed, 53 insertions, 15 deletions
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 5edb79a..b822a39 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -85,6 +85,7 @@ test_expect_success setup '
git format-patch --stdout first >patch1 &&
{
+ echo "Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
echo "X-Fake-Field: Line One" &&
echo "X-Fake-Field: Line Two" &&
echo "X-Fake-Field: Line Three" &&
@@ -273,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
@@ -290,17 +297,31 @@ 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
'
+test_expect_success 'am with config am.threeWay falls back to 3-way merge' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout -b lorem4 base3way &&
+ test_config am.threeWay 1 &&
+ git am lorem-move.patch &&
+ test_path_is_missing .git/rebase-apply &&
+ git diff --exit-code lorem
+'
+
+test_expect_success 'am with config am.threeWay overridden by --no-3way' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout -b lorem5 base3way &&
+ test_config am.threeWay 1 &&
+ test_must_fail git am --no-3way lorem-move.patch &&
+ test_path_is_dir .git/rebase-apply
+'
+
test_expect_success 'am can rename a file' '
grep "^rename from" rename.patch &&
rm -fr .git/rebase-apply &&
@@ -337,12 +358,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
'
@@ -536,4 +552,26 @@ test_expect_success 'am empty-file does not infloop' '
test_i18ncmp expected actual
'
+test_expect_success 'am --message-id really adds the message id' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout HEAD^ &&
+ git am --message-id patch1.eml &&
+ test_path_is_missing .git/rebase-apply &&
+ git cat-file commit HEAD | tail -n1 >actual &&
+ grep Message-Id patch1.eml >expected &&
+ test_cmp expected actual
+'
+
+test_expect_success 'am --message-id -s signs off after the message id' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout HEAD^ &&
+ git am -s --message-id patch1.eml &&
+ test_path_is_missing .git/rebase-apply &&
+ git cat-file commit HEAD | tail -n2 | head -n1 >actual &&
+ grep Message-Id patch1.eml >expected &&
+ test_cmp expected actual
+'
+
test_done