Merge early parts from git://ozlabs.org/~paulus/gitk.git
[gitweb.git] / builtin / commit-tree.c
index f641ff2a898cf76d288ed139772e247015ca554b..987a4c3d731d7cf01f61e4fddec208b4cb51a4af 100644 (file)
@@ -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);
 
@@ -66,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);