]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit.c
merge-recursive: fix verbose output for multiple base trees
[thirdparty/git.git] / commit.c
index 3f4f371e5eec41fa67345c0b9d373b541e52172a..fc3d6fb2c372a7f668ed41c94a9abb8e4ebd18ee 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -414,7 +414,7 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
        while (*p && (*p != '\n' || p[1] != '\n'))
                p++;
        if (*p) {
-               p += 2;
+               p = skip_blank_lines(p + 2);
                for (eol = p; *eol && *eol != '\n'; eol++)
                        ; /* do nothing */
        } else
@@ -1092,9 +1092,14 @@ static int do_sign_commit(struct strbuf *buf, const char *keyid)
 {
        struct strbuf sig = STRBUF_INIT;
        int inspos, copypos;
+       const char *eoh;
 
        /* find the end of the header */
-       inspos = strstr(buf->buf, "\n\n") - buf->buf + 1;
+       eoh = strstr(buf->buf, "\n\n");
+       if (!eoh)
+               inspos = buf->len;
+       else
+               inspos = eoh - buf->buf + 1;
 
        if (!keyid || !*keyid)
                keyid = get_signing_key();
@@ -1571,6 +1576,16 @@ int commit_tree_extended(const char *msg, size_t msg_len,
        return result;
 }
 
+void set_merge_remote_desc(struct commit *commit,
+                          const char *name, struct object *obj)
+{
+       struct merge_remote_desc *desc;
+       desc = xmalloc(sizeof(*desc));
+       desc->obj = obj;
+       desc->name = xstrdup(name);
+       commit->util = desc;
+}
+
 struct commit *get_merge_parent(const char *name)
 {
        struct object *obj;
@@ -1580,13 +1595,8 @@ struct commit *get_merge_parent(const char *name)
                return NULL;
        obj = parse_object(oid.hash);
        commit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
-       if (commit && !commit->util) {
-               struct merge_remote_desc *desc;
-               desc = xmalloc(sizeof(*desc));
-               desc->obj = obj;
-               desc->name = strdup(name);
-               commit->util = desc;
-       }
+       if (commit && !commit->util)
+               set_merge_remote_desc(commit, name, obj);
        return commit;
 }