]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tree: stop using the_repository
authorRené Scharfe <l.s.r@web.de>
Fri, 9 Jan 2026 21:30:20 +0000 (22:30 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 10 Jan 2026 02:36:17 +0000 (18:36 -0800)
Push the use of the_repository to the remaining callers by turning the
compatibility wrappers into macros, whose use still requires
USE_THE_REPOSITORY_VARIABLE to be defined.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tree.c
tree.h

diff --git a/tree.c b/tree.c
index edcf6a284cbb17cc640d09e78bf2fa0e8e20d4f1..d703ab97c8303a8643abbb302f99bbcff0bcbe03 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -1,5 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
-
 #include "git-compat-util.h"
 #include "hex.h"
 #include "tree.h"
@@ -185,11 +183,6 @@ int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
        return 0;
 }
 
-int parse_tree_gently(struct tree *item, int quiet_on_missing)
-{
-       return repo_parse_tree_gently(the_repository, item, quiet_on_missing);
-}
-
 int repo_parse_tree_gently(struct repository *r, struct tree *item,
                           int quiet_on_missing)
 {
@@ -219,11 +212,6 @@ void free_tree_buffer(struct tree *tree)
        tree->object.parsed = 0;
 }
 
-struct tree *parse_tree_indirect(const struct object_id *oid)
-{
-       return repo_parse_tree_indirect(the_repository, oid);
-}
-
 struct tree *repo_parse_tree_indirect(struct repository *r,
                                      const struct object_id *oid)
 {
diff --git a/tree.h b/tree.h
index 9037891d30fbb433b7db8f0ce208305d1c8de7f0..677382eed86c59904153df2f5de02cc51f27e139 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -19,13 +19,10 @@ struct tree *lookup_tree(struct repository *r, const struct object_id *oid);
 
 int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
 
-int parse_tree_gently(struct tree *tree, int quiet_on_missing);
+#define parse_tree_gently(t, q) repo_parse_tree_gently(the_repository, t, q)
 int repo_parse_tree_gently(struct repository *r, struct tree *item,
                           int quiet_on_missing);
-static inline int parse_tree(struct tree *tree)
-{
-       return parse_tree_gently(tree, 0);
-}
+#define parse_tree(t) repo_parse_tree(the_repository, t)
 static inline int repo_parse_tree(struct repository *r, struct tree *item)
 {
        return repo_parse_tree_gently(r, item, 0);
@@ -33,7 +30,7 @@ static inline int repo_parse_tree(struct repository *r, struct tree *item)
 void free_tree_buffer(struct tree *tree);
 
 /* Parses and returns the tree in the given ent, chasing tags and commits. */
-struct tree *parse_tree_indirect(const struct object_id *oid);
+#define parse_tree_indirect(o) repo_parse_tree_indirect(the_repository, o)
 struct tree *repo_parse_tree_indirect(struct repository *r,
                                      const struct object_id *oid);