sha1_file: refactor read_object
authorJonathan Tan <jonathantanmy@google.com>
Thu, 22 Jun 2017 00:40:21 +0000 (17:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Jun 2017 01:54:43 +0000 (18:54 -0700)
commitc84a1f3ed4d5314d2acc2bdca71b0bc5088423f9
tree2f9ee95868dc8fa2d7bf3594706f9087485a9a62
parent845b102b9951949a2413b3e6d425d9fb4424ff9e
sha1_file: refactor read_object

read_object() and sha1_object_info_extended() both implement mechanisms
such as object replacement, retrying the packed store after failing to
find the object in the packed store then the loose store, and being able
to mark a packed object as bad and then retrying the whole process.
Consolidating these mechanisms would be a great help to maintainability.

Therefore, consolidate them by extending sha1_object_info_extended() to
support the functionality needed, and then modifying read_object() to
use sha1_object_info_extended().

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