summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorJeremiah Mahler <jmmahler@gmail.com>2014-05-24 04:08:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-05-27 19:38:32 (GMT)
commit7022650f61ff7d7c9297db4a04f4e93ae14e1750 (patch)
tree3369dd500a78e0a1def31441b3b4be3b7c940085 /t/t4014-format-patch.sh
parentc6076e2b4aaebd4a49b01255fe8c67405704aa72 (diff)
downloadgit-7022650f61ff7d7c9297db4a04f4e93ae14e1750.zip
git-7022650f61ff7d7c9297db4a04f4e93ae14e1750.tar.gz
git-7022650f61ff7d7c9297db4a04f4e93ae14e1750.tar.bz2
format-patch: add "--signature-file=<file>" option
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-xt/t4014-format-patch.sh61
1 files changed, 61 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 9c80633..ae25353 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 &&