X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=object.c;h=0498b18d451b2335d21e2db3edc0ce7838aaa50e;hb=HEAD;hp=6b06297a5f06cc35cb266d6dd36c92df75a82de7;hpb=6a3a3db73f999af530490868c005f70d62d3391f;p=git.git diff --git a/object.c b/object.c index 6b06297a5..0498b18d4 100644 --- a/object.c +++ b/object.c @@ -198,6 +198,17 @@ struct object *parse_object(const unsigned char *sha1) if (obj && obj->parsed) return obj; + if ((obj && obj->type == OBJ_BLOB) || + (!obj && has_sha1_file(sha1) && + sha1_object_info(sha1, NULL) == OBJ_BLOB)) { + if (check_sha1_signature(repl, NULL, 0, NULL) < 0) { + error("sha1 mismatch %s\n", sha1_to_hex(repl)); + return NULL; + } + parse_blob_buffer(lookup_blob(sha1), NULL, 0); + return lookup_object(sha1); + } + buffer = read_sha1_file(sha1, &type, &size); if (buffer) { if (check_sha1_signature(repl, buffer, size, typename(type)) < 0) {