]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fmt-merge-msg.c
Merge branch 'js/t1450-making-it-writable-does-not-need-full-posixperm'
[thirdparty/git.git] / fmt-merge-msg.c
index 5216191488e20115949418aab527988ba7b81e7c..baca57d5b64c9f30bad08a505ccd7f1a9ba38546 100644 (file)
@@ -533,14 +533,14 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
                else {
                        buf = payload.buf;
                        len = payload.len;
-                       if (check_signature(payload.buf, payload.len, sig.buf,
-                                           sig.len, &sigc) &&
+                       sigc.payload_type = SIGNATURE_PAYLOAD_TAG;
+                       sigc.payload = strbuf_detach(&payload, &sigc.payload_len);
+                       if (check_signature(&sigc, sig.buf, sig.len) &&
                            !sigc.output)
                                strbuf_addstr(&sig, "gpg verification failed.\n");
                        else
                                strbuf_addstr(&sig, sigc.output);
                }
-               signature_check_clear(&sigc);
 
                if (!tag_number++) {
                        fmt_tag_signature(&tagbuf, &sig, buf, len);
@@ -564,6 +564,7 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
                }
                strbuf_release(&payload);
                strbuf_release(&sig);
+               signature_check_clear(&sigc);
        next:
                free(origbuf);
        }
@@ -649,12 +650,15 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
 
        memset(&merge_parents, 0, sizeof(merge_parents));
 
-       /* get current branch */
+       /* learn the commit that we merge into and the current branch name */
        current_branch = current_branch_to_free =
                resolve_refdup("HEAD", RESOLVE_REF_READING, &head_oid, NULL);
        if (!current_branch)
                die("No current branch");
-       if (starts_with(current_branch, "refs/heads/"))
+
+       if (opts->into_name)
+               current_branch = opts->into_name;
+       else if (starts_with(current_branch, "refs/heads/"))
                current_branch += 11;
 
        find_merge_parents(&merge_parents, in, &head_oid);