bundle: verify arguments more strictly
[gitweb.git] / builtin / merge.c
index b11a528ce5580d5e5b9b61f291e0d829a735ae6a..8763b2efa2d7e3d7af49e9bc160a67239fbd3147 100644 (file)
@@ -220,7 +220,7 @@ static struct option builtin_merge_options[] = {
        OPT_BOOL(0, "abort", &abort_current_merge,
                N_("abort the current in-progress merge")),
        OPT_SET_INT(0, "progress", &show_progress, N_("force progress reporting"), 1),
-       { OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key id"),
+       { OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
          N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
        OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")),
        OPT_END()
@@ -597,6 +597,9 @@ static int git_merge_config(const char *k, const char *v, void *cb)
        } else if (!strcmp(k, "merge.defaulttoupstream")) {
                default_to_upstream = git_config_bool(k, v);
                return 0;
+       } else if (!strcmp(k, "commit.gpgsign")) {
+               sign_commit = git_config_bool(k, v) ? "" : NULL;
+               return 0;
        }
 
        status = fmt_merge_msg_config(k, v, cb);
@@ -849,8 +852,8 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
        parent->next->item = remoteheads->item;
        parent->next->next = NULL;
        prepare_to_commit(remoteheads);
-       if (commit_tree(&merge_msg, result_tree, parent, result_commit, NULL,
-                       sign_commit))
+       if (commit_tree(merge_msg.buf, merge_msg.len, result_tree, parent,
+                       result_commit, NULL, sign_commit))
                die(_("failed to write commit object"));
        finish(head, remoteheads, result_commit, "In-index merge");
        drop_save();
@@ -874,8 +877,8 @@ static int finish_automerge(struct commit *head,
                commit_list_insert(head, &parents);
        strbuf_addch(&merge_msg, '\n');
        prepare_to_commit(remoteheads);
-       if (commit_tree(&merge_msg, result_tree, parents, result_commit,
-                       NULL, sign_commit))
+       if (commit_tree(merge_msg.buf, merge_msg.len, result_tree, parents,
+                       result_commit, NULL, sign_commit))
                die(_("failed to write commit object"));
        strbuf_addf(&buf, "Merge made by the '%s' strategy.", wt_strategy);
        finish(head, remoteheads, result_commit, buf.buf);