@matheusbsbs / matheus-bagliano / commits / 6f9012b625
Fork 0

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>

Junio C Hamano committed Jun 2, 2006 at 15:23 UTC 6f9012b62517ca490e4131f24e03ff842527f1b9
1 file changed +10 -3
fetch.c
+10 -3
@@ -46,13 +46,20 @@ static int process_tree(struct tree *tree)
46 desc.buf = tree->buffer;
47 desc.size = tree->size;
48 while (tree_entry(&desc, &entry)) {
49 + struct object *obj = NULL;
50 +
51 if (S_ISDIR(entry.mode)) {
52 struct tree *tree = lookup_tree(entry.sha1);
51 - process_tree(tree);
52 - } else {
53 + if (tree)
54 + obj = &tree->object;
55 + }
56 + else {
57 struct blob *blob = lookup_blob(entry.sha1);
54 - process(&blob->object);
58 + if (blob)
59 + obj = &blob->object;
60 }
61 + if (!obj || process(obj))
62 + return -1;
63 }
64 free(tree->buffer);
65 tree->buffer = NULL;