path: root/t/
diff options
authorTigran Mkrtchyan <>2019-06-05 21:33:21 (GMT)
committerJunio C Hamano <>2019-06-05 21:39:28 (GMT)
commit1c6b565f896c27dc7c52aa3af9c7dcfc7934e8fe (patch)
tree350d0bf7a190a6cd5527ea5afc8520354ca06ab2 /t/
parent74583d89127e21255c12dd3c8a3bf60b497d7d03 (diff)
tag: add tag.gpgSign config option to force all tags be GPG-signed
As many CI/CD tools don't allow to control command line options when executing `git tag` command, a default value in the configuration file will allow to enforce tag signing if required. The new config-file option tag.gpgSign is added to define default behavior of tag signings. To override default behavior the command line option -s, --sign and --no-sign can be used: $ git tag -m "commit message" will generate a GPG signed tag if tag.gpgSign option is true, while $ git tag --no-sign -m "commit message" will skip the signing step. Signed-off-by: Tigran Mkrtchyan <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 21 insertions, 0 deletions
diff --git a/t/ b/t/
index 6aeeb27..80eb13d 100755
--- a/t/
+++ b/t/
@@ -932,6 +932,27 @@ test_expect_success GPG \
test_cmp expect actual
+get_tag_header gpgsign-enabled $commit commit $time >expect
+echo "A message" >>expect
+echo '-----BEGIN PGP SIGNATURE-----' >>expect
+test_expect_success GPG \
+ 'git tag configured tag.gpgsign enables GPG sign' \
+ 'test_config tag.gpgsign true &&
+ git tag -m "A message" gpgsign-enabled &&
+ get_tag_msg gpgsign-enabled>actual &&
+ test_cmp expect actual
+get_tag_header no-sign $commit commit $time >expect
+echo "A message" >>expect
+test_expect_success GPG \
+ 'git tag --no-sign configured tag.gpgsign skip GPG sign' \
+ 'test_config tag.gpgsign true &&
+ git tag -a --no-sign -m "A message" no-sign &&
+ get_tag_msg no-sign>actual &&
+ test_cmp expect actual
test_expect_success GPG \
'trying to create a signed tag with non-existing -F file should fail' '
! test -f nonexistingfile &&