All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add the tag.gpgsign option to sign all created tags
@ 2016-03-19 18:23 Laurent Arnoud
  2016-03-20  4:29 ` Jeff King
  0 siblings, 1 reply; 22+ messages in thread
From: Laurent Arnoud @ 2016-03-19 18:23 UTC (permalink / raw)
  To: gitster; +Cc: git

The tag.gpgsign config option allows to sign all
commits automatically.

Signed-off-by: Laurent Arnoud <laurent@spkdev.net>
---
 Documentation/config.txt |  3 +++
 builtin/tag.c            | 19 ++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 2cd6bdd..076c68a 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2729,6 +2729,9 @@ submodule.<name>.ignore::
 	"--ignore-submodules" option. The 'git submodule' commands are not
 	affected by this setting.
 
+tag.gpgSign::
+	A boolean to specify whether all tags created should be GPG signed.
+
 tag.sort::
 	This variable controls the sort ordering of tags when displayed by
 	linkgit:git-tag[1]. Without the "--sort=<value>" option provided, the
diff --git a/builtin/tag.c b/builtin/tag.c
index 1705c94..53cad28 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -29,6 +29,7 @@ static const char * const git_tag_usage[] = {
 };
 
 static unsigned int colopts;
+static const char *sign_tag;
 
 static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, const char *format)
 {
@@ -166,6 +167,11 @@ static int git_tag_config(const char *var, const char *value, void *cb)
 	status = git_gpg_config(var, value, cb);
 	if (status)
 		return status;
+	if (!strcmp(var, "tag.gpgsign")) {
+		sign_tag = git_config_bool(var, value) ? "" : NULL;
+		return 0;
+	}
+
 	if (starts_with(var, "column."))
 		return git_column_config(var, value, "tag", &colopts);
 	return git_default_config(var, value, cb);
@@ -381,14 +387,21 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
 	argc = parse_options(argc, argv, prefix, options, git_tag_usage, 0);
 
+	if (argc == 0 && !cmdmode)
+		cmdmode = 'l';
+
+	/* Remove config option when calling command other than create tag */
+	if (cmdmode != 0 && sign_tag)
+		sign_tag = NULL;
+
 	if (keyid) {
 		opt.sign = 1;
 		set_signing_key(keyid);
 	}
-	if (opt.sign)
+	if (opt.sign || sign_tag) {
+		opt.sign = 1;
 		annotate = 1;
-	if (argc == 0 && !cmdmode)
-		cmdmode = 'l';
+	}
 
 	if ((annotate || msg.given || msgfile || force) && (cmdmode != 0))
 		usage_with_options(git_tag_usage, options);
-- 
2.7.0


-- 
Laurent

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-03-22 20:41 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-19 18:23 [PATCH] Add the tag.gpgsign option to sign all created tags Laurent Arnoud
2016-03-20  4:29 ` Jeff King
2016-03-20 12:20   ` Laurent Arnoud
2016-03-20 16:52     ` Jeff King
2016-03-20 17:44       ` Laurent Arnoud
2016-03-20 15:07   ` [PATCH v2] " Laurent Arnoud
2016-03-20 16:38     ` Ramsay Jones
2016-03-21  5:50     ` Junio C Hamano
2016-03-21 19:29       ` Laurent Arnoud
2016-03-21 19:43         ` Junio C Hamano
2016-03-21 20:01           ` Laurent Arnoud
2016-03-21 20:04           ` Jeff King
2016-03-21 20:50           ` [PATCH v4] Add the tag.gpgsign option to sign annotated tags Laurent Arnoud
2016-03-21 21:26             ` Junio C Hamano
2016-03-22 19:36               ` [PATCH v5] Add the option to force " Laurent Arnoud
2016-03-22 19:48                 ` Junio C Hamano
2016-03-22 20:07                   ` Laurent Arnoud
2016-03-22 20:41                   ` [PATCH v6] " Laurent Arnoud
2016-03-21 22:06           ` [PATCH v2] Add the tag.gpgsign option to sign all created tags Junio C Hamano
2016-03-21 19:32       ` [PATCH v3] Add the tag.gpgsign option to sign annotated tags Laurent Arnoud
2016-03-21 19:42         ` Jeff King
2016-03-21 19:53       ` [PATCH v2] Add the tag.gpgsign option to sign all created tags Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.