1
0
mirror of https://github.com/git/git synced 2024-07-05 00:58:49 +00:00

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>
This commit is contained in:
Paul Tan 2015-07-19 23:49:16 +08:00 committed by Junio C Hamano
parent 3ef4446bf2
commit bf72ac17d7

View File

@ -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" &&