diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:55 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:55 -0800 |
commit | d1afa8baa271fe0df1a15a6800f23f972abc5293 (patch) | |
tree | 004b439c43f83336c011139f0ddff67a45b7d233 /object.c | |
parent | 2bbf77dde2b47f2b8c9769c4d64f7f2f591d1e99 (diff) | |
parent | 90108a2441fb57f69c3f25d072d1952b306b77ab (diff) | |
download | git-d1afa8baa271fe0df1a15a6800f23f972abc5293.tar.gz git-d1afa8baa271fe0df1a15a6800f23f972abc5293.tar.xz |
Merge branch 'jk/parse-object-cached'
* jk/parse-object-cached:
upload-pack: avoid parsing tag destinations
upload-pack: avoid parsing objects during ref advertisement
parse_object: try internal cache before reading object db
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -191,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)); |