Skip to content

Commit

Permalink
t4150: tests for am --[no-]scissors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Tan authored and Junio C Hamano committed Jul 20, 2015
1 parent 3ef4446 commit bf72ac1
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions t/t4150-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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>"
'

Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -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" &&
Expand Down

0 comments on commit bf72ac1

Please sign in to comment.