11 static int process_tree(unsigned char *sha1
)
13 struct tree
*tree
= lookup_tree(sha1
);
14 struct tree_entry_list
*entries
;
19 for (entries
= tree
->entries
; entries
; entries
= entries
->next
) {
20 if (fetch(entries
->item
.tree
->object
.sha1
))
22 if (entries
->directory
) {
23 if (process_tree(entries
->item
.tree
->object
.sha1
))
30 static int process_commit(unsigned char *sha1
)
32 struct commit
*obj
= lookup_commit(sha1
);
37 if (parse_commit(obj
))
41 if (fetch(obj
->tree
->object
.sha1
))
43 if (process_tree(obj
->tree
->object
.sha1
))
49 struct commit_list
*parents
= obj
->parents
;
50 for (; parents
; parents
= parents
->next
) {
51 if (has_sha1_file(parents
->item
->object
.sha1
))
53 if (fetch(parents
->item
->object
.sha1
)) {
54 /* The server might not have it, and
59 if (process_commit(parents
->item
->object
.sha1
))
66 int pull(char *target
)
69 unsigned char sha1
[20];
70 retval
= get_sha1_hex(target
, sha1
);
76 return process_commit(sha1
);