branch: group related arguments of create_branch()
[gitweb.git] / builtin / merge.c
index ab5ffe85e8f5d7a359004f2bbb52a5778d0b91b4..612dd7bfb6c7e6ae6f636e0b2e55bfed1aff92f2 100644 (file)
@@ -405,9 +405,8 @@ static void finish(struct commit *head_commit,
                        printf(_("No merge message -- not updating HEAD\n"));
                else {
                        const char *argv_gc_auto[] = { "gc", "--auto", NULL };
-                       update_ref(reflog_message.buf, "HEAD",
-                               new_head->hash, head->hash, 0,
-                               UPDATE_REFS_DIE_ON_ERR);
+                       update_ref(reflog_message.buf, "HEAD", new_head, head,
+                                  0, UPDATE_REFS_DIE_ON_ERR);
                        /*
                         * We ignore errors in 'gc --auto', since the
                         * user should see them.
@@ -455,7 +454,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
        if (!remote_head)
                die(_("'%s' does not point to a commit"), remote);
 
-       if (dwim_ref(remote, strlen(remote), branch_head.hash, &found_ref) > 0) {
+       if (dwim_ref(remote, strlen(remote), &branch_head, &found_ref) > 0) {
                if (starts_with(found_ref, "refs/heads/")) {
                        strbuf_addf(msg, "%s\t\tbranch '%s' of .\n",
                                    oid_to_hex(&branch_head), remote);
@@ -999,6 +998,7 @@ static struct commit_list *reduce_parents(struct commit *head_commit,
 
        /* Find what parents to record by checking independent ones. */
        parents = reduce_heads(remoteheads);
+       free_commit_list(remoteheads);
 
        remoteheads = NULL;
        remotes = &remoteheads;
@@ -1143,7 +1143,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
         * Check if we are _not_ on a detached HEAD, i.e. if there is a
         * current branch.
         */
-       branch = branch_to_free = resolve_refdup("HEAD", 0, head_oid.hash, NULL);
+       branch = branch_to_free = resolve_refdup("HEAD", 0, &head_oid, NULL);
        if (branch)
                skip_prefix(branch, "refs/heads/", &branch);
        if (!branch || is_null_oid(&head_oid))
@@ -1261,8 +1261,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                        die(_("Can merge only exactly one commit into empty head"));
                remote_head_oid = &remoteheads->item->object.oid;
                read_empty(remote_head_oid->hash, 0);
-               update_ref("initial pull", "HEAD", remote_head_oid->hash,
-                          NULL, 0, UPDATE_REFS_DIE_ON_ERR);
+               update_ref("initial pull", "HEAD", remote_head_oid, NULL, 0,
+                          UPDATE_REFS_DIE_ON_ERR);
                goto done;
        }
 
@@ -1357,8 +1357,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                free(list);
        }
 
-       update_ref("updating ORIG_HEAD", "ORIG_HEAD", head_commit->object.oid.hash,
-                  NULL, 0, UPDATE_REFS_DIE_ON_ERR);
+       update_ref("updating ORIG_HEAD", "ORIG_HEAD",
+                  &head_commit->object.oid, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
 
        if (remoteheads && !common) {
                /* No common ancestors found. */