git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 09/10] tree: stop using the_repository

From
René Scharfe <l.s.r@web.de>
Date
Jan 9, 2026, 21:30 UTC
Message-ID
<20260109213021.2546-10-l.s.r@web.de>
In-Reply-To
<20260109213021.2546-1-l.s.r@web.de>

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>
---
 tree.c | 12 ------------
 tree.h |  9 +++------
 2 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/tree.c b/tree.c
index edcf6a284cb..d703ab97c83 100644
--- 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 9037891d30f..677382eed86 100644
--- 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);
 
-- 
2.52.0
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 6 of 25 in “tree: stop using the_repository”
  1. 00/10 tree: stop using the_repositoryRené Scharfe, Jan 9, 2026
  2. 03/10 add-interactive: use repo_parse_tree_indirect()René Scharfe, Jan 9, 2026
  3. 04/10 bloom: use repo_parse_tree()René Scharfe, Jan 9, 2026
  4. 08/10 tree: use repo_parse_tree()René Scharfe, Jan 9, 2026
  5. Patrick SteinhardtJan 12, 2026
  6. 09/10 tree: stop using the_repositoryRené Scharfe, Jan 9, 2026
  7. Patrick SteinhardtJan 12, 2026
  8. Junio C HamanoJan 12, 2026
  9. Patrick SteinhardtJan 12, 2026
  10. Junio C HamanoJan 12, 2026
  11. Junio C HamanoJan 12, 2026
  12. Patrick SteinhardtJan 12, 2026
  13. René ScharfeJan 12, 2026
  14. Patrick SteinhardtJan 13, 2026
  15. 10/10 cocci: convert parse_tree functions to repo_ variantsRené Scharfe, Jan 9, 2026
  16. 02/10 tree: add repo_parse_tree*()René Scharfe, Jan 9, 2026
  17. 01/10 environment: move access to core.maxTreeDepth into repo settingsRené Scharfe, Jan 9, 2026
  18. Patrick SteinhardtJan 12, 2026
  19. René ScharfeJan 12, 2026
  20. 07/10 path-walk: use repo_parse_tree_gently()René Scharfe, Jan 9, 2026
  21. 05/10 delta-islands: use repo_parse_tree()René Scharfe, Jan 9, 2026
  22. 06/10 pack-bitmap-write: use repo_parse_tree()René Scharfe, Jan 9, 2026
  23. 11/10 cocci: remove obsolete the_repository rulesRené Scharfe, Jan 15, 2026
  24. Patrick SteinhardtJan 16, 2026
  25. Junio C HamanoJan 16, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.