Add raw tree buffer info to "struct tree"
This allows us to avoid allocating information for names etc, because we can just use the information from the tree buffer directly. We still keep the old "tree_entry_list" in struct tree as well, so old users aren't affected, apart from the fact that the allocations are different (if you free a tree entry, you should no longer free the name allocation for it, since it's allocated as part of "tree->buffer") Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
committed by
Junio C Hamano
parent
7d65848afd
commit
d2eafb7661
5
object.c
5
object.c
@ -200,8 +200,11 @@ struct object *parse_object(const unsigned char *sha1)
|
||||
obj = &blob->object;
|
||||
} else if (!strcmp(type, tree_type)) {
|
||||
struct tree *tree = lookup_tree(sha1);
|
||||
parse_tree_buffer(tree, buffer, size);
|
||||
obj = &tree->object;
|
||||
if (!tree->object.parsed) {
|
||||
parse_tree_buffer(tree, buffer, size);
|
||||
buffer = NULL;
|
||||
}
|
||||
} else if (!strcmp(type, commit_type)) {
|
||||
struct commit *commit = lookup_commit(sha1);
|
||||
parse_commit_buffer(commit, buffer, size);
|
||||
|
||||
Reference in New Issue
Block a user