diff options
author | Jeremiah Mahler <jmmahler@gmail.com> | 2014-05-23 21:08:14 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-27 12:38:32 -0700 |
commit | 7022650f61ff7d7c9297db4a04f4e93ae14e1750 (patch) | |
tree | 3369dd500a78e0a1def31441b3b4be3b7c940085 /t/t4014-format-patch.sh | |
parent | c6076e2b4aaebd4a49b01255fe8c67405704aa72 (diff) | |
download | git-7022650f61ff7d7c9297db4a04f4e93ae14e1750.tar.gz |
format-patch: add "--signature-file=<file>" optionjm/format-patch-mail-sig
Add an option to format-patch for reading a signature from a file.
$ git format-patch -1 --signature-file=$HOME/.signature
The config variable `format.signaturefile` can also be used to make
this the default.
$ git config format.signaturefile $HOME/.signature
$ git format-patch -1
Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-x | t/t4014-format-patch.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 9c80633146..ae25353a14 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -762,6 +762,67 @@ test_expect_success 'format-patch --signature="" suppresses signatures' ' ! grep "^-- \$" output ' +test_expect_success 'prepare mail-signature input' ' + cat >mail-signature <<-\EOF + + Test User <test.email@kernel.org> + http://git.kernel.org/cgit/git/git.git + + git.kernel.org/?p=git/git.git;a=summary + + EOF +' + +test_expect_success '--signature-file=file works' ' + git format-patch --stdout --signature-file=mail-signature -1 >output && + check_patch output && + sed -e "1,/^-- \$/d" <output >actual && + { + cat mail-signature && echo + } >expect && + test_cmp expect actual +' + +test_expect_success 'format.signaturefile works' ' + test_config format.signaturefile mail-signature && + git format-patch --stdout -1 >output && + check_patch output && + sed -e "1,/^-- \$/d" <output >actual && + { + cat mail-signature && echo + } >expect && + test_cmp expect actual +' + +test_expect_success '--no-signature suppresses format.signaturefile ' ' + test_config format.signaturefile mail-signature && + git format-patch --stdout --no-signature -1 >output && + check_patch output && + ! grep "^-- \$" output +' + +test_expect_success '--signature-file overrides format.signaturefile' ' + cat >other-mail-signature <<-\EOF + Use this other signature instead of mail-signature. + EOF + test_config format.signaturefile mail-signature && + git format-patch --stdout \ + --signature-file=other-mail-signature -1 >output && + check_patch output && + sed -e "1,/^-- \$/d" <output >actual && + { + cat other-mail-signature && echo + } >expect && + test_cmp expect actual +' + +test_expect_success '--signature overrides format.signaturefile' ' + test_config format.signaturefile mail-signature && + git format-patch --stdout --signature="my sig" -1 >output && + check_patch output && + grep "my sig" output +' + test_expect_success TTY 'format-patch --stdout paginates' ' rm -f pager_used && test_terminal env GIT_PAGER="wc >pager_used" git format-patch --stdout --all && |