summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2010-06-16 05:59:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-16 17:08:59 (GMT)
commit6622d9c7103525bb8673f93df4104ab2a46cb174 (patch)
tree627447656621a876401a1739f431518468531031 /t/t4014-format-patch.sh
parent6068cdcc832040ac644c56953be0670bb09afd12 (diff)
downloadgit-6622d9c7103525bb8673f93df4104ab2a46cb174.zip
git-6622d9c7103525bb8673f93df4104ab2a46cb174.tar.gz
git-6622d9c7103525bb8673f93df4104ab2a46cb174.tar.bz2
format-patch: Add a signature option (--signature)
By default, git uses the version string as the signature for all patches output by format-patch. Many employers (mine included) require the use of a signature on all outgoing mails. In a format-patch | send-email workflow there isn't an easy way to modify the signature without breaking the pipe and manually replacing the version string with the signature required. Instead of doing all that work, add an option (--signature) and a config variable (format.signature) to replace the default git version signature when formatting patches. This does modify the original behavior of format-patch a bit. First off the version string is now placed in the cover letter by default. Secondly, once the configuration variable format.signature is added to the .config file there is no way to revert back to the default git version signature. Instead, specifying the --no-signature option will remove the signature from the patches entirely. Signed-off-by: Stephen Boyd <bebarino@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.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index d21c37f..f87434b 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -613,4 +613,56 @@ test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
git format-patch --ignore-if-in-upstream HEAD
'
+test_expect_success 'format-patch --signature' '
+ git format-patch --stdout --signature="my sig" -1 >output &&
+ grep "my sig" output
+'
+
+test_expect_success 'format-patch with format.signature config' '
+ git config format.signature "config sig" &&
+ git format-patch --stdout -1 >output &&
+ grep "config sig" output
+'
+
+test_expect_success 'format-patch --signature overrides format.signature' '
+ git config format.signature "config sig" &&
+ git format-patch --stdout --signature="overrides" -1 >output &&
+ ! grep "config sig" output &&
+ grep "overrides" output
+'
+
+test_expect_success 'format-patch --no-signature ignores format.signature' '
+ git config format.signature "config sig" &&
+ git format-patch --stdout --signature="my sig" --no-signature \
+ -1 >output &&
+ ! grep "config sig" output &&
+ ! grep "my sig" output &&
+ ! grep "^-- \$" output
+'
+
+test_expect_success 'format-patch --signature --cover-letter' '
+ git config --unset-all format.signature &&
+ git format-patch --stdout --signature="my sig" --cover-letter \
+ -1 >output &&
+ grep "my sig" output &&
+ test 2 = $(grep "my sig" output | wc -l)
+'
+
+test_expect_success 'format.signature="" supresses signatures' '
+ git config format.signature "" &&
+ git format-patch --stdout -1 >output &&
+ ! grep "^-- \$" output
+'
+
+test_expect_success 'format-patch --no-signature supresses signatures' '
+ git config --unset-all format.signature &&
+ git format-patch --stdout --no-signature -1 >output &&
+ ! grep "^-- \$" output
+'
+
+test_expect_success 'format-patch --signature="" supresses signatures' '
+ git format-patch --signature="" -1 >output &&
+ ! grep "^-- \$" output
+'
+
test_done