]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cocci: convert parse_tree functions to repo_ variants
authorRené Scharfe <l.s.r@web.de>
Fri, 9 Jan 2026 21:30:21 +0000 (22:30 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 10 Jan 2026 02:36:18 +0000 (18:36 -0800)
Add and apply a semantic patch to convert calls to parse_tree() and
friends to the corresponding variant that takes a repository argument,
to allow the functions that implicitly use the_repository to be retired
once all potential in-flight topics are settled and converted as well.

The changes in .c files were generated by Coccinelle, but I fixed a
whitespace bug it would have introduced to builtin/commit.c.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
27 files changed:
archive.c
builtin/am.c
builtin/checkout.c
builtin/clone.c
builtin/commit.c
builtin/diff-tree.c
builtin/ls-tree.c
builtin/merge-tree.c
builtin/merge.c
builtin/read-tree.c
builtin/reset.c
builtin/stash.c
cache-tree.c
contrib/coccinelle/the_repository.cocci
diff-lib.c
fsck.c
http-push.c
list-objects.c
merge-ort.c
merge.c
read-cache.c
reset.c
revision.c
sequencer.c
t/helper/test-cache-tree.c
t/helper/test-match-trees.c
walker.c

index 310672b479a19f0f424780af072f8a6b39d6e424..fcd474c682ffe5d7ba5fc5ea9abf466f4f7015d3 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -519,7 +519,7 @@ static void parse_treeish_arg(const char **argv,
        if (ar_args->mtime_option)
                archive_time = approxidate(ar_args->mtime_option);
 
-       tree = parse_tree_indirect(&oid);
+       tree = repo_parse_tree_indirect(the_repository, &oid);
        if (!tree)
                die(_("not a tree object: %s"), oid_to_hex(&oid));
 
index 277c2e7937dcc1f4d2e6e7bfb33df0c13fda64db..b66a33d8a8899c6d5e0f9c05ea6f04873df420ae 100644 (file)
@@ -1998,7 +1998,7 @@ static int fast_forward_to(struct tree *head, struct tree *remote, int reset)
        struct unpack_trees_options opts;
        struct tree_desc t[2];
 
-       if (parse_tree(head) || parse_tree(remote))
+       if (repo_parse_tree(the_repository, head) || repo_parse_tree(the_repository, remote))
                return -1;
 
        repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
@@ -2038,7 +2038,7 @@ static int merge_tree(struct tree *tree)
        struct unpack_trees_options opts;
        struct tree_desc t[1];
 
-       if (parse_tree(tree))
+       if (repo_parse_tree(the_repository, tree))
                return -1;
 
        repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
@@ -2071,11 +2071,11 @@ static int clean_index(const struct object_id *head, const struct object_id *rem
        struct tree *head_tree, *remote_tree, *index_tree;
        struct object_id index;
 
-       head_tree = parse_tree_indirect(head);
+       head_tree = repo_parse_tree_indirect(the_repository, head);
        if (!head_tree)
                return error(_("Could not parse object '%s'."), oid_to_hex(head));
 
-       remote_tree = parse_tree_indirect(remote);
+       remote_tree = repo_parse_tree_indirect(the_repository, remote);
        if (!remote_tree)
                return error(_("Could not parse object '%s'."), oid_to_hex(remote));
 
@@ -2089,7 +2089,7 @@ static int clean_index(const struct object_id *head, const struct object_id *rem
                                0, NULL))
                return -1;
 
-       index_tree = parse_tree_indirect(&index);
+       index_tree = repo_parse_tree_indirect(the_repository, &index);
        if (!index_tree)
                return error(_("Could not parse object '%s'."), oid_to_hex(&index));
 
index 261699e2f5fc97956c264bc0300b4aee64d1f287..0ba4f03f2ee064d1fd4488e9aefb1e3abaacf2af 100644 (file)
@@ -724,7 +724,7 @@ static int reset_tree(struct tree *tree, const struct checkout_opts *o,
        init_checkout_metadata(&opts.meta, info->refname,
                               info->commit ? &info->commit->object.oid : null_oid(the_hash_algo),
                               NULL);
-       if (parse_tree(tree) < 0)
+       if (repo_parse_tree(the_repository, tree) < 0)
                return 128;
        init_tree_desc(&tree_desc, &tree->object.oid, tree->buffer, tree->size);
        switch (unpack_trees(1, &tree_desc, &opts)) {
@@ -803,7 +803,8 @@ static int merge_working_tree(const struct checkout_opts *opts,
        if (opts->new_orphan_branch && opts->orphan_from_empty_tree) {
                if (new_branch_info->commit)
                        BUG("'switch --orphan' should never accept a commit as starting point");
-               new_tree = parse_tree_indirect(the_hash_algo->empty_tree);
+               new_tree = repo_parse_tree_indirect(the_repository,
+                                                   the_hash_algo->empty_tree);
                if (!new_tree)
                        BUG("unable to read empty tree");
        } else {
@@ -841,14 +842,15 @@ static int merge_working_tree(const struct checkout_opts *opts,
                old_commit_oid = old_branch_info->commit ?
                        &old_branch_info->commit->object.oid :
                        the_hash_algo->empty_tree;
-               tree = parse_tree_indirect(old_commit_oid);
+               tree = repo_parse_tree_indirect(the_repository,
+                                               old_commit_oid);
                if (!tree)
                        die(_("unable to parse commit %s"),
                                oid_to_hex(old_commit_oid));
 
                init_tree_desc(&trees[0], &tree->object.oid,
                               tree->buffer, tree->size);
-               if (parse_tree(new_tree) < 0)
+               if (repo_parse_tree(the_repository, new_tree) < 0)
                        die(NULL);
                tree = new_tree;
                init_tree_desc(&trees[1], &tree->object.oid,
@@ -1278,7 +1280,7 @@ static void setup_new_branch_info_and_source_tree(
        new_branch_info->commit = lookup_commit_reference_gently(the_repository, rev, 1);
        if (!new_branch_info->commit) {
                /* not a commit */
-               *source_tree = parse_tree_indirect(rev);
+               *source_tree = repo_parse_tree_indirect(the_repository, rev);
                if (!*source_tree)
                        die(_("unable to read tree (%s)"), oid_to_hex(rev));
        } else {
index b19b302b06546710b7c8bc20b696a0944c9f1b78..b40cee596804f5547e73f38a36521cf889debce6 100644 (file)
@@ -680,10 +680,10 @@ static int checkout(int submodule_progress, int filter_submodules,
        opts.dst_index = the_repository->index;
        init_checkout_metadata(&opts.meta, head, &oid, NULL);
 
-       tree = parse_tree_indirect(&oid);
+       tree = repo_parse_tree_indirect(the_repository, &oid);
        if (!tree)
                die(_("unable to parse commit %s"), oid_to_hex(&oid));
-       if (parse_tree(tree) < 0)
+       if (repo_parse_tree(the_repository, tree) < 0)
                exit(128);
        init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
        if (unpack_trees(1, &t, &opts) < 0)
index 0243f17d53c97c62432ce77249966d4ef4ed7100..8e901fe8db79421c7b667edf84abe7f7db0adc6f 100644 (file)
@@ -327,10 +327,11 @@ static void create_base_index(const struct commit *current_head)
        opts.dst_index = the_repository->index;
 
        opts.fn = oneway_merge;
-       tree = parse_tree_indirect(&current_head->object.oid);
+       tree = repo_parse_tree_indirect(the_repository,
+                                       &current_head->object.oid);
        if (!tree)
                die(_("failed to unpack HEAD tree object"));
-       if (parse_tree(tree) < 0)
+       if (repo_parse_tree(the_repository, tree) < 0)
                exit(128);
        init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
        if (unpack_trees(1, &t, &opts))
index 49dd4d00ebf1bcc644383ee99df3a9e05502b89b..740d9a791c9c1d34de68482fa87e86dc005ec51a 100644 (file)
@@ -52,7 +52,7 @@ static int stdin_diff_trees(struct tree *tree1, const char *p)
        if (!isspace(*p++) || parse_oid_hex(p, &oid, &p) || *p)
                return error("Need exactly two trees, separated by a space");
        tree2 = lookup_tree(the_repository, &oid);
-       if (!tree2 || parse_tree(tree2))
+       if (!tree2 || repo_parse_tree(the_repository, tree2))
                return -1;
        printf("%s %s\n", oid_to_hex(&tree1->object.oid),
                          oid_to_hex(&tree2->object.oid));
index ec6940fc7c4b9c78a9a0f8ff9aaec5dfe8926909..113e4a960dc7dd4166c958577b4d732b036285a4 100644 (file)
@@ -421,7 +421,7 @@ int cmd_ls_tree(int argc,
        for (i = 0; i < options.pathspec.nr; i++)
                options.pathspec.items[i].nowildcard_len = options.pathspec.items[i].len;
        options.pathspec.has_wildcard = 0;
-       tree = parse_tree_indirect(&oid);
+       tree = repo_parse_tree_indirect(the_repository, &oid);
        if (!tree)
                die("not a tree object");
        /*
index 1c063d9a41a695a2abfc60aa99af2b327e786195..a6e6d5b555f7db63209f9aee25a3f46f0fddb5ca 100644 (file)
@@ -447,17 +447,20 @@ static int real_merge(struct merge_tree_options *o,
 
                if (repo_get_oid_treeish(the_repository, merge_base, &base_oid))
                        die(_("could not parse as tree '%s'"), merge_base);
-               base_tree = parse_tree_indirect(&base_oid);
+               base_tree = repo_parse_tree_indirect(the_repository,
+                                                    &base_oid);
                if (!base_tree)
                        die(_("unable to read tree (%s)"), oid_to_hex(&base_oid));
                if (repo_get_oid_treeish(the_repository, branch1, &head_oid))
                        die(_("could not parse as tree '%s'"), branch1);
-               parent1_tree = parse_tree_indirect(&head_oid);
+               parent1_tree = repo_parse_tree_indirect(the_repository,
+                                                       &head_oid);
                if (!parent1_tree)
                        die(_("unable to read tree (%s)"), oid_to_hex(&head_oid));
                if (repo_get_oid_treeish(the_repository, branch2, &merge_oid))
                        die(_("could not parse as tree '%s'"), branch2);
-               parent2_tree = parse_tree_indirect(&merge_oid);
+               parent2_tree = repo_parse_tree_indirect(the_repository,
+                                                       &merge_oid);
                if (!parent2_tree)
                        die(_("unable to read tree (%s)"), oid_to_hex(&merge_oid));
 
index c421a11b0b69df13fd2ee3ebe416d1dfe1cd8bce..50001b4c59f083b1ec74897ee2f2340114d79d7f 100644 (file)
@@ -756,19 +756,19 @@ static int read_tree_trivial(struct object_id *common, struct object_id *head,
        opts.trivial_merges_only = 1;
        opts.merge = 1;
        opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
-       trees[nr_trees] = parse_tree_indirect(common);
+       trees[nr_trees] = repo_parse_tree_indirect(the_repository, common);
        if (!trees[nr_trees++])
                return -1;
-       trees[nr_trees] = parse_tree_indirect(head);
+       trees[nr_trees] = repo_parse_tree_indirect(the_repository, head);
        if (!trees[nr_trees++])
                return -1;
-       trees[nr_trees] = parse_tree_indirect(one);
+       trees[nr_trees] = repo_parse_tree_indirect(the_repository, one);
        if (!trees[nr_trees++])
                return -1;
        opts.fn = threeway_merge;
        cache_tree_free(&the_repository->index->cache_tree);
        for (i = 0; i < nr_trees; i++) {
-               parse_tree(trees[i]);
+               repo_parse_tree(the_repository, trees[i]);
                init_tree_desc(t+i, &trees[i]->object.oid,
                               trees[i]->buffer, trees[i]->size);
        }
index 34f7a59f38ee22b8aca68c432109b18da54168ab..460b21e40ac914cd43a439064d537c9b3dd35a19 100644 (file)
@@ -32,7 +32,7 @@ static int list_tree(struct object_id *oid)
 
        if (nr_trees >= MAX_UNPACK_TREES)
                die("I cannot read more than %d trees", MAX_UNPACK_TREES);
-       tree = parse_tree_indirect(oid);
+       tree = repo_parse_tree_indirect(the_repository, oid);
        if (!tree)
                return -1;
        trees[nr_trees++] = tree;
@@ -268,7 +268,7 @@ int cmd_read_tree(int argc,
        cache_tree_free(&the_repository->index->cache_tree);
        for (i = 0; i < nr_trees; i++) {
                struct tree *tree = trees[i];
-               if (parse_tree(tree) < 0)
+               if (repo_parse_tree(the_repository, tree) < 0)
                        return 128;
                init_tree_desc(t+i, &tree->object.oid, tree->buffer, tree->size);
        }
index ed35802af15c94e367be30de76fb96df43ffe441..c48d9845f8425efbd55e9002d5b514684c788aa4 100644 (file)
@@ -118,7 +118,7 @@ static int reset_index(const char *ref, const struct object_id *oid, int reset_t
                goto out;
 
        if (reset_type == MIXED || reset_type == HARD) {
-               tree = parse_tree_indirect(oid);
+               tree = repo_parse_tree_indirect(the_repository, oid);
                if (!tree) {
                        error(_("unable to read tree (%s)"), oid_to_hex(oid));
                        goto out;
@@ -417,7 +417,7 @@ int cmd_reset(int argc,
                struct tree *tree;
                if (repo_get_oid_treeish(the_repository, rev, &oid))
                        die(_("Failed to resolve '%s' as a valid tree."), rev);
-               tree = parse_tree_indirect(&oid);
+               tree = repo_parse_tree_indirect(the_repository, &oid);
                if (!tree)
                        die(_("Could not parse object '%s'."), rev);
                oidcpy(&oid, &tree->object.oid);
index 948eba06fbccb3060d116db5862816ddc5d1485d..193e3ea47a17c8be5d8061ad7afe682878926e5c 100644 (file)
@@ -347,8 +347,8 @@ static int reset_tree(struct object_id *i_tree, int update, int reset)
 
        memset(&opts, 0, sizeof(opts));
 
-       tree = parse_tree_indirect(i_tree);
-       if (parse_tree(tree))
+       tree = repo_parse_tree_indirect(the_repository, i_tree);
+       if (repo_parse_tree(the_repository, tree))
                return -1;
 
        init_tree_desc(t, &tree->object.oid, tree->buffer, tree->size);
@@ -940,8 +940,8 @@ static void diff_include_untracked(const struct stash_info *info, struct diff_op
        struct unpack_trees_options unpack_tree_opt = { 0 };
 
        for (size_t i = 0; i < ARRAY_SIZE(oid); i++) {
-               tree[i] = parse_tree_indirect(oid[i]);
-               if (parse_tree(tree[i]) < 0)
+               tree[i] = repo_parse_tree_indirect(the_repository, oid[i]);
+               if (repo_parse_tree(the_repository, tree[i]) < 0)
                        die(_("failed to parse tree"));
                init_tree_desc(&tree_desc[i], &tree[i]->object.oid,
                               tree[i]->buffer, tree[i]->size);
index 2d8947b51878407200236f0d0e894645f69934ea..16c3a36b48267b10850b8d2faf1466a7f3bf6c72 100644 (file)
@@ -813,7 +813,7 @@ static void prime_cache_tree_rec(struct repository *r,
                        struct cache_tree_sub *sub;
                        struct tree *subtree = lookup_tree(r, &entry.oid);
 
-                       if (parse_tree(subtree) < 0)
+                       if (repo_parse_tree(the_repository, subtree) < 0)
                                exit(128);
                        sub = cache_tree_sub(it, entry.path);
                        sub->cache_tree = cache_tree();
index ea7fe1c8db78f39a72f17a90fef439447adb794e..a1f6f5ac06c253d831121cf2ed65844c448c1d2b 100644 (file)
 |
 - init_revisions
 + repo_init_revisions
+// tree.h
+|
+- parse_tree
++ repo_parse_tree
+|
+- parse_tree_gently
++ repo_parse_tree_gently
+|
+- parse_tree_indirect
++ repo_parse_tree_indirect
 )
   (
 + the_repository,
index 5307390ff3db7bd90cc01913cefb76eb5e1a5d9d..506000761d4db53ac153be4b482ae4b9805febe4 100644 (file)
@@ -552,7 +552,7 @@ static int diff_cache(struct rev_info *revs,
        struct tree_desc t;
        struct unpack_trees_options opts;
 
-       tree = parse_tree_indirect(tree_oid);
+       tree = repo_parse_tree_indirect(the_repository, tree_oid);
        if (!tree)
                return error("bad tree object %s",
                             tree_name ? tree_name : oid_to_hex(tree_oid));
diff --git a/fsck.c b/fsck.c
index fae18d8561e0673bda4a627f5610bb5202991a83..5532f5ae9f938db33bc986b12683a02943fa5fbe 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -360,7 +360,7 @@ static int fsck_walk_tree(struct tree *tree, void *data, struct fsck_options *op
        int res = 0;
        const char *name;
 
-       if (parse_tree(tree))
+       if (repo_parse_tree(the_repository, tree))
                return -1;
 
        name = fsck_get_object_name(options, &tree->object.oid);
index 60a9b756209071aa434ac42712bd95e3991d05e4..cc0f80934615ba8f953c6e52f54bcc846c3e7c16 100644 (file)
@@ -1311,7 +1311,7 @@ static struct object_list **process_tree(struct tree *tree,
 
        if (obj->flags & (UNINTERESTING | SEEN))
                return p;
-       if (parse_tree(tree) < 0)
+       if (repo_parse_tree(the_repository, tree) < 0)
                die("bad tree object %s", oid_to_hex(&obj->oid));
 
        obj->flags |= SEEN;
index 1279676ddca4df3d176b13180237e7b7356eff25..91b23e22f71aac2320fc99dc61dd3132ecca070e 100644 (file)
@@ -170,7 +170,7 @@ static void process_tree(struct traversal_context *ctx,
        if (ctx->depth > revs->repo->settings.max_allowed_tree_depth)
                die("exceeded maximum allowed tree depth");
 
-       failed_parse = parse_tree_gently(tree, 1);
+       failed_parse = repo_parse_tree_gently(the_repository, tree, 1);
        if (failed_parse) {
                if (revs->ignore_missing_links)
                        return;
index 2b837a58c3a6f8c3c604e99623c360f9ba70bbec..e80e4f735a60f049c68c653946d0a6d407926afd 100644 (file)
@@ -1732,9 +1732,9 @@ static int collect_merge_info(struct merge_options *opt,
        info.data = opt;
        info.show_all_errors = 1;
 
-       if (parse_tree(merge_base) < 0 ||
-           parse_tree(side1) < 0 ||
-           parse_tree(side2) < 0)
+       if (repo_parse_tree(the_repository, merge_base) < 0 ||
+           repo_parse_tree(the_repository, side1) < 0 ||
+           repo_parse_tree(the_repository, side2) < 0)
                return -1;
        init_tree_desc(t + 0, &merge_base->object.oid,
                       merge_base->buffer, merge_base->size);
@@ -4619,10 +4619,10 @@ static int checkout(struct merge_options *opt,
        unpack_opts.verbose_update = (opt->verbosity > 2);
        unpack_opts.fn = twoway_merge;
        unpack_opts.preserve_ignored = 0; /* FIXME: !opts->overwrite_ignore */
-       if (parse_tree(prev) < 0)
+       if (repo_parse_tree(the_repository, prev) < 0)
                return -1;
        init_tree_desc(&trees[0], &prev->object.oid, prev->buffer, prev->size);
-       if (parse_tree(next) < 0)
+       if (repo_parse_tree(the_repository, next) < 0)
                return -1;
        init_tree_desc(&trees[1], &next->object.oid, next->buffer, next->size);
 
@@ -5280,7 +5280,8 @@ redo:
 
        if (result->clean >= 0) {
                if (!opt->mergeability_only) {
-                       result->tree = parse_tree_indirect(&working_tree_oid);
+                       result->tree = repo_parse_tree_indirect(the_repository,
+                                                               &working_tree_oid);
                        if (!result->tree)
                                die(_("unable to read tree (%s)"),
                                    oid_to_hex(&working_tree_oid));
diff --git a/merge.c b/merge.c
index 5ecaf508e4cb98d6093fff0f2da0a27f777dd016..0f5e823e63ed5fe29c654078f13fc5ad6dee4b61 100644 (file)
--- a/merge.c
+++ b/merge.c
@@ -68,18 +68,18 @@ int checkout_fast_forward(struct repository *r,
        memset(&trees, 0, sizeof(trees));
        memset(&t, 0, sizeof(t));
 
-       trees[nr_trees] = parse_tree_indirect(head);
+       trees[nr_trees] = repo_parse_tree_indirect(the_repository, head);
        if (!trees[nr_trees++]) {
                rollback_lock_file(&lock_file);
                return -1;
        }
-       trees[nr_trees] = parse_tree_indirect(remote);
+       trees[nr_trees] = repo_parse_tree_indirect(the_repository, remote);
        if (!trees[nr_trees++]) {
                rollback_lock_file(&lock_file);
                return -1;
        }
        for (i = 0; i < nr_trees; i++) {
-               if (parse_tree(trees[i]) < 0) {
+               if (repo_parse_tree(the_repository, trees[i]) < 0) {
                        rollback_lock_file(&lock_file);
                        return -1;
                }
index 990d4ead0d8ae462876f276a23c6a475b2b95f8c..e9c1b23e48437a4825d366352beec290d909adab 100644 (file)
@@ -3807,7 +3807,7 @@ void overlay_tree_on_index(struct index_state *istate,
 
        if (repo_get_oid(the_repository, tree_name, &oid))
                die("tree-ish %s not found.", tree_name);
-       tree = parse_tree_indirect(&oid);
+       tree = repo_parse_tree_indirect(the_repository, &oid);
        if (!tree)
                die("bad tree-ish %s", tree_name);
 
diff --git a/reset.c b/reset.c
index bb590271811ec2ce004cbbfdd000cc9854e2e182..46e30e639458c51a781d82d93a19efbe3cbebd8e 100644 (file)
--- a/reset.c
+++ b/reset.c
@@ -163,7 +163,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)
                goto leave_reset_head;
        }
 
-       tree = parse_tree_indirect(oid);
+       tree = repo_parse_tree_indirect(the_repository, oid);
        if (!tree) {
                ret = error(_("unable to read tree (%s)"), oid_to_hex(oid));
                goto leave_reset_head;
index 5f0850ae5c9c1aec7838b0a9e05e2951a6f50fdd..426d19a2c6c8c307d717450b1b5dfa2d07251fa1 100644 (file)
@@ -72,7 +72,7 @@ static void mark_tree_contents_uninteresting(struct repository *r,
        struct tree_desc desc;
        struct name_entry entry;
 
-       if (parse_tree_gently(tree, 1) < 0)
+       if (repo_parse_tree_gently(the_repository, tree, 1) < 0)
                return;
 
        init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size);
@@ -179,7 +179,7 @@ static void add_children_by_path(struct repository *r,
        if (!tree)
                return;
 
-       if (parse_tree_gently(tree, 1) < 0)
+       if (repo_parse_tree_gently(the_repository, tree, 1) < 0)
                return;
 
        init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size);
index 71ed31c774068862104efe5faaa1eb02870861e6..cccde58bee96fba25bf3f55fbb754b684cf79180 100644 (file)
@@ -767,7 +767,7 @@ static int do_recursive_merge(struct repository *r,
                o.buffer_output = 2;
        o.show_rename_progress = 1;
 
-       head_tree = parse_tree_indirect(head);
+       head_tree = repo_parse_tree_indirect(the_repository, head);
        if (!head_tree)
                return error(_("unable to read tree (%s)"), oid_to_hex(head));
        next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);
@@ -4052,7 +4052,7 @@ static int do_reset(struct repository *r,
                goto cleanup;
        }
 
-       tree = parse_tree_indirect(&oid);
+       tree = repo_parse_tree_indirect(the_repository, &oid);
        if (!tree)
                return error(_("unable to read tree (%s)"), oid_to_hex(&oid));
        prime_cache_tree(r, r->index, tree);
index 3ae45cec3be6390c8220dab95a403c573ce719a2..ff61d0ca7e2fe31cdebba06aa4b4473f6e6a9f70 100644 (file)
@@ -41,7 +41,7 @@ int cmd__cache_tree(int argc, const char **argv)
                die(_("unable to read index file"));
 
        oidcpy(&oid, &the_repository->index->cache_tree->oid);
-       tree = parse_tree_indirect(&oid);
+       tree = repo_parse_tree_indirect(the_repository, &oid);
        if (!tree)
                die(_("not a tree object: %s"), oid_to_hex(&oid));
 
index e0e2048320d58363e6ca582801f9ecfdf9f4fcc9..2ed064b9716ac8e19411d36eac0c386c3f0c2952 100644 (file)
@@ -19,10 +19,10 @@ int cmd__match_trees(int ac UNUSED, const char **av)
                die("cannot parse %s as an object name", av[1]);
        if (repo_get_oid(the_repository, av[2], &hash2))
                die("cannot parse %s as an object name", av[2]);
-       one = parse_tree_indirect(&hash1);
+       one = repo_parse_tree_indirect(the_repository, &hash1);
        if (!one)
                die("not a tree-ish %s", av[1]);
-       two = parse_tree_indirect(&hash2);
+       two = repo_parse_tree_indirect(the_repository, &hash2);
        if (!two)
                die("not a tree-ish %s", av[2]);
 
index 2891563b03620bc82b2e11a6712f407652ff2661..91332539d3a286a96e00d177ca8df65daade54d4 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -45,7 +45,7 @@ static int process_tree(struct walker *walker, struct tree *tree)
        struct tree_desc desc;
        struct name_entry entry;
 
-       if (parse_tree(tree))
+       if (repo_parse_tree(the_repository, tree))
                return -1;
 
        init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size);