summaryrefslogtreecommitdiff
path: root/builtin/commit-tree.c
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mars-attacks.org>2013-11-04 23:14:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-02-24 22:50:56 (GMT)
commitd95bfb12b87a0be9666f806683e198df9738d0e7 (patch)
tree37908b19d235a3c94dbf375ea457d9e0249c5319 /builtin/commit-tree.c
parentf26f72de159d7ade2fbe8b48734ce98c1aba4d72 (diff)
downloadgit-d95bfb12b87a0be9666f806683e198df9738d0e7.zip
git-d95bfb12b87a0be9666f806683e198df9738d0e7.tar.gz
git-d95bfb12b87a0be9666f806683e198df9738d0e7.tar.bz2
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 <boklm@mars-attacks.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit-tree.c')
-rw-r--r--builtin/commit-tree.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index f641ff2..1646d5b 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 <sha1>)...] [-S[<keyid>]] [-m <message>] [-F <file>] <sha1> <changelog";
+static const char *sign_commit;
+
static void new_parent(struct commit *parent, struct commit_list **parents_p)
{
unsigned char *sha1 = parent->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);