summaryrefslogtreecommitdiff
path: root/fetch.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-06-02 15:23:47 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-06-02 15:23:47 -0700
commit6f9012b62517ca490e4131f24e03ff842527f1b9 (patch)
treeae5e031f9edb42d007a0977c20fafdbcb41e98d0 /fetch.c
parenttree_entry(): new tree-walking helper function (diff)
downloadtgif-6f9012b62517ca490e4131f24e03ff842527f1b9.tar.xz
fetch.c: do not call process_tree() from process_tree().
This function reads a freshly fetched tree object, and schedules the objects pointed by it for further fetching, so doing lookup_tree() and process_tree() recursively from there does not make much sense. We need to use process() on it to make sure we fetch it first, and leave the recursive processing to later stages. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'fetch.c')
-rw-r--r--fetch.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fetch.c b/fetch.c
index ec2d8c3d9b..107504b72b 100644
--- a/fetch.c
+++ b/fetch.c
@@ -46,13 +46,20 @@ static int process_tree(struct tree *tree)
desc.buf = tree->buffer;
desc.size = tree->size;
while (tree_entry(&desc, &entry)) {
+ struct object *obj = NULL;
+
if (S_ISDIR(entry.mode)) {
struct tree *tree = lookup_tree(entry.sha1);
- process_tree(tree);
- } else {
+ if (tree)
+ obj = &tree->object;
+ }
+ else {
struct blob *blob = lookup_blob(entry.sha1);
- process(&blob->object);
+ if (blob)
+ obj = &blob->object;
}
+ if (!obj || process(obj))
+ return -1;
}
free(tree->buffer);
tree->buffer = NULL;