]> git.ipfire.org Git - thirdparty/git.git/commit - sha1-file.c
sha1_file: do not access pack if unneeded
authorJonathan Tan <jonathantanmy@google.com>
Thu, 22 Jun 2017 00:40:23 +0000 (17:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Jun 2017 17:28:58 +0000 (10:28 -0700)
commitcd585e2a33841d725b821adbb9b48654fc7d0b61
tree60982a4e7d9dfe0828792f326ed0a9684f4810df
parentdfdd4afcf97b0199f44231e726e373934da77717
sha1_file: do not access pack if unneeded

Currently, regardless of the contents of the "struct object_info" passed
to sha1_object_info_extended(), that function always accesses the
packfile whenever it returns information about a packed object, since it
needs to populate "u.packed".

Add the ability to pass NULL, and use NULL-ness of the argument to
activate an optimization in which sha1_object_info_extended() does not
needlessly access the packfile. A subsequent patch will make use of this
optimization.

A similar optimization is not made for the cached and loose cases as it
would not cause a significant performance improvement.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c