From d95bfb12b87a0be9666f806683e198df9738d0e7 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Tue, 5 Nov 2013 00:14:41 +0100 Subject: commit-tree: add the commit.gpgsign option to sign all commits If you want to GPG sign all your commits, you have to add the -S option all the time. The commit.gpgsign config option allows to sign all commits automatically. Signed-off-by: Nicolas Vigier Signed-off-by: Junio C Hamano --- builtin/commit-tree.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'builtin/commit-tree.c') diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index f641ff2a8..1646d5b25 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -12,6 +12,8 @@ static const char commit_tree_usage[] = "git commit-tree [(-p )...] [-S[]] [-m ] [-F ] object.sha1; @@ -31,6 +33,10 @@ static int commit_tree_config(const char *var, const char *value, void *cb) int status = git_gpg_config(var, value, NULL); if (status) return status; + if (!strcmp(var, "commit.gpgsign")) { + sign_commit = git_config_bool(var, value) ? "" : NULL; + return 0; + } return git_default_config(var, value, cb); } @@ -41,7 +47,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) unsigned char tree_sha1[20]; unsigned char commit_sha1[20]; struct strbuf buffer = STRBUF_INIT; - const char *sign_commit = NULL; git_config(commit_tree_config, NULL); -- cgit v1.2.1 From 55ca3f99ae4895605a348322dd2fc50f2065f508 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 13 Dec 2013 15:40:35 -0800 Subject: commit-tree: add and document --no-gpg-sign Document how to override commit.gpgsign configuration that is set to true per "git commit" invocation (parse-options machinery lets us say "--no-gpg-sign" to do so). "git commit-tree" does not use parse-options, so manually add the corresponding option for now. Signed-off-by: Junio C Hamano --- builtin/commit-tree.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'builtin/commit-tree.c') diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 1646d5b25..987a4c3d7 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -71,6 +71,11 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) continue; } + if (!strcmp(arg, "--no-gpg-sign")) { + sign_commit = NULL; + continue; + } + if (!strcmp(arg, "-m")) { if (argc <= ++i) usage(commit_tree_usage); -- cgit v1.2.1