path: root/tree-walk.c
diff options
authorJeff King <>2020-02-01 11:39:22 (GMT)
committerJunio C Hamano <>2020-02-04 18:32:15 (GMT)
commit5290d4513496d89f84570985a0e02e97dff477ff (patch)
tree0087ed94f0234309e2d4862c1d7e6e4e809a8890 /tree-walk.c
parent8dd40c0472a8f51f4fba4b8fd28dc3e9421cd7d7 (diff)
tree-walk.c: break circular dependency with unpack-trees
The unpack-trees API depends on the tree-walk API. But we've recently introduced a dependency in tree-walk.c on MAX_UNPACK_TREES, which doesn't otherwise care about unpack-trees at all. Let's break that dependency by reversing the constants: we'll introduce a new MAX_TRAVERSE_TREES which belongs to the tree-walk API. And then we can define MAX_UNPACK_TREES in terms of that (since unpack-trees cannot possibly work with more trees than it can traverse at once via tree-walk). The value for both will remain at 8. This is somewhat arbitrary and probably more than is necessary, per ca885a4fe6 (read-tree() and unpack_trees(): use consistent limit, 2008-03-13), but there's not really any pressing need to reduce it. Suggested-by: Elijah Newren <> Signed-off-by: Jeff King <> Acked-by: Elijah Newren <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'tree-walk.c')
1 files changed, 1 insertions, 2 deletions
diff --git a/tree-walk.c b/tree-walk.c
index 3093cf7..bb0ad34 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -1,6 +1,5 @@
#include "cache.h"
#include "tree-walk.h"
-#include "unpack-trees.h"
#include "dir.h"
#include "object-store.h"
#include "tree.h"
@@ -410,7 +409,7 @@ int traverse_trees(struct index_state *istate,
struct traverse_info *info)
int error = 0;
- struct name_entry entry[MAX_UNPACK_TREES];
+ struct name_entry entry[MAX_TRAVERSE_TREES];
int i;
struct tree_desc_x tx[ARRAY_SIZE(entry)];
struct strbuf base = STRBUF_INIT;