diff options
-rw-r--r-- | sha1_file.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c index 9fd7e166d..0b830c864 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2020,9 +2020,17 @@ static int sha1_loose_object_info(const unsigned char *sha1, unsigned long *size int sha1_object_info(const unsigned char *sha1, unsigned long *sizep) { + struct cached_object *co; struct pack_entry e; int status; + co = find_cached_object(sha1); + if (co) { + if (sizep) + *sizep = co->size; + return co->type; + } + if (!find_pack_entry(sha1, &e)) { /* Most likely it's a loose object. */ status = sha1_loose_object_info(sha1, sizep); |