summaryrefslogtreecommitdiff
path: root/tree-walk.c
diff options
context:
space:
mode:
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/tree-walk.c b/tree-walk.c
index c5569b3e9f..506e12a031 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -502,7 +502,9 @@ struct dir_state {
struct object_id oid;
};
-static int find_tree_entry(struct tree_desc *t, const char *name, struct object_id *result, unsigned short *mode)
+static int find_tree_entry(struct repository *r, struct tree_desc *t,
+ const char *name, struct object_id *result,
+ unsigned short *mode)
{
int namelen = strlen(name);
while (t->size) {
@@ -532,19 +534,23 @@ static int find_tree_entry(struct tree_desc *t, const char *name, struct object_
oidcpy(result, &oid);
return 0;
}
- return get_tree_entry(&oid, name + entrylen, result, mode);
+ return get_tree_entry(r, &oid, name + entrylen, result, mode);
}
return -1;
}
-int get_tree_entry(const struct object_id *tree_oid, const char *name, struct object_id *oid, unsigned short *mode)
+int get_tree_entry(struct repository *r,
+ const struct object_id *tree_oid,
+ const char *name,
+ struct object_id *oid,
+ unsigned short *mode)
{
int retval;
void *tree;
unsigned long size;
struct object_id root;
- tree = read_object_with_reference(the_repository, tree_oid, tree_type, &size, &root);
+ tree = read_object_with_reference(r, tree_oid, tree_type, &size, &root);
if (!tree)
return -1;
@@ -559,7 +565,7 @@ int get_tree_entry(const struct object_id *tree_oid, const char *name, struct ob
} else {
struct tree_desc t;
init_tree_desc(&t, tree, size);
- retval = find_tree_entry(&t, name, oid, mode);
+ retval = find_tree_entry(r, &t, name, oid, mode);
}
free(tree);
return retval;
@@ -681,7 +687,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, c
}
/* Look up the first (or only) path component in the tree. */
- find_result = find_tree_entry(&t, namebuf.buf,
+ find_result = find_tree_entry(the_repository, &t, namebuf.buf,
&current_tree_oid, mode);
if (find_result) {
goto done;