return result;
}
-void *fill_tree_descriptor(struct tree_desc *desc, const struct object_id *oid)
+void *fill_tree_descriptor(struct repository *r,
+ struct tree_desc *desc,
+ const struct object_id *oid)
{
unsigned long size = 0;
void *buf = NULL;
if (oid) {
- buf = read_object_with_reference(oid, tree_type, &size, NULL);
+ buf = read_object_with_reference(r, oid, tree_type, &size, NULL);
if (!buf)
die("unable to read tree %s", oid_to_hex(oid));
}
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) {
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(tree_oid, tree_type, &size, &root);
+ tree = read_object_with_reference(r, tree_oid, tree_type, &size, &root);
if (!tree)
return -1;
} 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;
* See the code for enum get_oid_result for a description of
* the return values.
*/
-enum get_oid_result get_tree_entry_follow_symlinks(struct object_id *tree_oid, const char *name, struct object_id *result, struct strbuf *result_path, unsigned short *mode)
+enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
+ struct object_id *tree_oid, const char *name,
+ struct object_id *result, struct strbuf *result_path,
+ unsigned short *mode)
{
int retval = MISSING_OBJECT;
struct dir_state *parents = NULL;
void *tree;
struct object_id root;
unsigned long size;
- tree = read_object_with_reference(¤t_tree_oid,
+ tree = read_object_with_reference(r,
+ ¤t_tree_oid,
tree_type, &size,
&root);
if (!tree)
}
/* Look up the first (or only) path component in the tree. */
- find_result = find_tree_entry(&t, namebuf.buf,
+ find_result = find_tree_entry(r, &t, namebuf.buf,
¤t_tree_oid, mode);
if (find_result) {
goto done;
*/
retval = DANGLING_SYMLINK;
- contents = read_object_file(¤t_tree_oid, &type,
+ contents = repo_read_object_file(r,
+ ¤t_tree_oid, &type,
&link_len);
if (!contents)