Skip to content

Commit

Permalink
fetch.c: do not call process_tree() from process_tree().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jun 2, 2006
1 parent 4c068a9 commit 6f9012b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6f9012b

Please sign in to comment.