]> git.ipfire.org Git - thirdparty/git.git/blobdiff - merge-recursive.c
t5318: avoid unnecessary command substitutions
[thirdparty/git.git] / merge-recursive.c
index f110e1c5ecbd6254b25785ecb49f29cb7bb75ed2..1dd6ec384de132d24f96b2ee89639bb765de9589 100644 (file)
@@ -8,6 +8,8 @@
 #include "advice.h"
 #include "lockfile.h"
 #include "cache-tree.h"
+#include "object-store.h"
+#include "repository.h"
 #include "commit.h"
 #include "blob.h"
 #include "builtin.h"
@@ -15,6 +17,7 @@
 #include "diff.h"
 #include "diffcore.h"
 #include "tag.h"
+#include "alloc.h"
 #include "unpack-trees.h"
 #include "string-list.h"
 #include "xdiff-interface.h"
@@ -155,12 +158,12 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
        }
        if (!oidcmp(&two->object.oid, &shifted))
                return two;
-       return lookup_tree(&shifted);
+       return lookup_tree(the_repository, &shifted);
 }
 
 static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
 {
-       struct commit *commit = alloc_commit_node();
+       struct commit *commit = alloc_commit_node(the_repository);
 
        set_merge_remote_desc(commit, comment, (struct object *)commit);
        commit->maybe_tree = tree;
@@ -286,10 +289,12 @@ static void output(struct merge_options *o, int v, const char *fmt, ...)
 
 static void output_commit_title(struct merge_options *o, struct commit *commit)
 {
+       struct merge_remote_desc *desc;
+
        strbuf_addchars(&o->obuf, ' ', o->call_depth * 2);
-       if (commit->util)
-               strbuf_addf(&o->obuf, "virtual %s\n",
-                       merge_remote_util(commit)->name);
+       desc = merge_remote_util(commit);
+       if (desc)
+               strbuf_addf(&o->obuf, "virtual %s\n", desc->name);
        else {
                strbuf_add_unique_abbrev(&o->obuf, &commit->object.oid,
                                         DEFAULT_ABBREV);
@@ -411,7 +416,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
                return NULL;
        }
 
-       result = lookup_tree(&active_cache_tree->oid);
+       result = lookup_tree(the_repository, &active_cache_tree->oid);
 
        return result;
 }
@@ -1187,9 +1192,9 @@ static int merge_submodule(struct merge_options *o,
                return 0;
        }
 
-       if (!(commit_base = lookup_commit_reference(base)) ||
-           !(commit_a = lookup_commit_reference(a)) ||
-           !(commit_b = lookup_commit_reference(b))) {
+       if (!(commit_base = lookup_commit_reference(the_repository, base)) ||
+           !(commit_a = lookup_commit_reference(the_repository, a)) ||
+           !(commit_b = lookup_commit_reference(the_repository, b))) {
                output(o, 1, _("Failed to merge submodule %s (commits not present)"), path);
                return 0;
        }
@@ -3400,7 +3405,7 @@ int merge_recursive(struct merge_options *o,
                /* if there is no common ancestor, use an empty tree */
                struct tree *tree;
 
-               tree = lookup_tree(the_hash_algo->empty_tree);
+               tree = lookup_tree(the_repository, the_repository->hash_algo->empty_tree);
                merged_common_ancestors = make_virtual_commit(tree, "ancestor");
        }
 
@@ -3462,7 +3467,9 @@ static struct commit *get_ref(const struct object_id *oid, const char *name)
 {
        struct object *object;
 
-       object = deref_tag(parse_object(oid), name, strlen(name));
+       object = deref_tag(the_repository, parse_object(the_repository, oid),
+                          name,
+                          strlen(name));
        if (!object)
                return NULL;
        if (object->type == OBJ_TREE)