summaryrefslogtreecommitdiff
path: root/t/t4150-am.sh
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2015-07-19 15:49:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-20 17:52:43 (GMT)
commitbf72ac17d7c9441fd30f9a9764b399c74142204b (patch)
tree1dadcf07f58044bbdc57d1d896b1dc00897c11a4 /t/t4150-am.sh
parent3ef4446bf23f7c7ecafb275f833b155608484146 (diff)
downloadgit-bf72ac17d7c9441fd30f9a9764b399c74142204b.zip
git-bf72ac17d7c9441fd30f9a9764b399c74142204b.tar.gz
git-bf72ac17d7c9441fd30f9a9764b399c74142204b.tar.bz2
t4150: tests for am --[no-]scissors
Since 017678b (am/mailinfo: Disable scissors processing by default, 2009-08-26), git-am supported the --[no-]scissors option, passing it to git-mailinfo. Add tests to ensure that git-am will pass the --scissors option to git-mailinfo, and that --no-scissors will override the configuration setting of mailinfo.scissors. Reviewed-by: Stefan Beller <sbeller@google.com> Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4150-am.sh')
-rwxr-xr-xt/t4150-am.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 7494240..67fbf0e 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -67,6 +67,19 @@ test_expect_success 'setup: messages' '
EOF
+ cat >scissors-msg <<-\EOF &&
+ Test git-am with scissors line
+
+ This line should be included in the commit message.
+ EOF
+
+ cat - scissors-msg >no-scissors-msg <<-\EOF &&
+ This line should not be included in the commit message with --scissors enabled.
+
+ - - >8 - - remove everything above this line - - >8 - -
+
+ EOF
+
signoff="Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
'
@@ -105,6 +118,20 @@ test_expect_success setup '
git format-patch --stdout first | sed -e "1d"
} > patch1-ws.eml &&
+ echo scissors-file >scissors-file &&
+ git add scissors-file &&
+ git commit -F scissors-msg &&
+ git tag scissors &&
+ git format-patch --stdout scissors^ >scissors-patch.eml &&
+ git reset --hard HEAD^ &&
+
+ echo no-scissors-file >no-scissors-file &&
+ git add no-scissors-file &&
+ git commit -F no-scissors-msg &&
+ git tag no-scissors &&
+ git format-patch --stdout no-scissors^ >no-scissors-patch.eml &&
+ git reset --hard HEAD^ &&
+
sed -n -e "3,\$p" msg >file &&
git add file &&
test_tick &&
@@ -305,6 +332,27 @@ test_expect_success 'am with failing post-applypatch hook' '
test_cmp head.expected head.actual
'
+test_expect_success 'am --scissors cuts the message at the scissors line' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout second &&
+ git am --scissors scissors-patch.eml &&
+ test_path_is_missing .git/rebase-apply &&
+ git diff --exit-code scissors &&
+ test_cmp_rev scissors HEAD
+'
+
+test_expect_success 'am --no-scissors overrides mailinfo.scissors' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout second &&
+ test_config mailinfo.scissors true &&
+ git am --no-scissors no-scissors-patch.eml &&
+ test_path_is_missing .git/rebase-apply &&
+ git diff --exit-code no-scissors &&
+ test_cmp_rev no-scissors HEAD
+'
+
test_expect_success 'setup: new author and committer' '
GIT_AUTHOR_NAME="Another Thor" &&
GIT_AUTHOR_EMAIL="a.thor@example.com" &&