X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=object.c;h=6b06297a5f06cc35cb266d6dd36c92df75a82de7;hb=7010146f90abf0e4954690f6cd38a8463786fec7;hp=31976b5d70b6310552b04ce79c7ea0b07bc536d7;hpb=8b482c0ccca22857709e7f483f0079d7be7327f6;p=git.git diff --git a/object.c b/object.c index 31976b5d7..6b06297a5 100644 --- a/object.c +++ b/object.c @@ -149,6 +149,8 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t struct tree *tree = lookup_tree(sha1); if (tree) { obj = &tree->object; + if (!tree->buffer) + tree->object.parsed = 0; if (!tree->object.parsed) { if (parse_tree_buffer(tree, buffer, size)) return NULL; @@ -189,10 +191,15 @@ struct object *parse_object(const unsigned char *sha1) enum object_type type; int eaten; const unsigned char *repl = lookup_replace_object(sha1); - void *buffer = read_sha1_file(sha1, &type, &size); + void *buffer; + struct object *obj; + + obj = lookup_object(sha1); + if (obj && obj->parsed) + return obj; + buffer = read_sha1_file(sha1, &type, &size); if (buffer) { - struct object *obj; if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) { free(buffer); error("sha1 mismatch %s\n", sha1_to_hex(repl));