aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-read-tree.c9
-rw-r--r--unpack-trees.c6
-rw-r--r--unpack-trees.h2
3 files changed, 9 insertions, 8 deletions
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 160456dad..e9cfd2bbc 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -13,16 +13,15 @@
#include "dir.h"
#include "builtin.h"
-#define MAX_TREES 8
static int nr_trees;
-static struct tree *trees[MAX_TREES];
+static struct tree *trees[MAX_UNPACK_TREES];
static int list_tree(unsigned char *sha1)
{
struct tree *tree;
- if (nr_trees >= MAX_TREES)
- die("I cannot read more than %d trees", MAX_TREES);
+ if (nr_trees >= MAX_UNPACK_TREES)
+ die("I cannot read more than %d trees", MAX_UNPACK_TREES);
tree = parse_tree_indirect(sha1);
if (!tree)
return -1;
@@ -97,7 +96,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
{
int i, newfd, stage = 0;
unsigned char sha1[20];
- struct tree_desc t[MAX_TREES];
+ struct tree_desc t[MAX_UNPACK_TREES];
struct unpack_trees_options opts;
memset(&opts, 0, sizeof(opts));
diff --git a/unpack-trees.c b/unpack-trees.c
index be89d52e8..91649f31d 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -123,7 +123,7 @@ static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_option
int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info)
{
int i;
- struct tree_desc t[3];
+ struct tree_desc t[MAX_UNPACK_TREES];
struct traverse_info newinfo;
struct name_entry *p;
@@ -327,8 +327,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
{
static struct cache_entry *dfc;
- if (len > 4)
- die("unpack_trees takes at most four trees");
+ if (len > MAX_UNPACK_TREES)
+ die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
memset(&state, 0, sizeof(state));
state.base_dir = "";
state.force = 1;
diff --git a/unpack-trees.h b/unpack-trees.h
index e8abbcd03..50453ed20 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -1,6 +1,8 @@
#ifndef UNPACK_TREES_H
#define UNPACK_TREES_H
+#define MAX_UNPACK_TREES 8
+
struct unpack_trees_options;
typedef int (*merge_fn_t)(struct cache_entry **src,