diff options
author | Jeff King <peff@peff.net> | 2018-11-12 09:50:56 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-13 14:22:03 +0900 |
commit | 3a2e08245cfccd932bb3ff78521e07d4a38c2834 (patch) | |
tree | eedf38839cf088ba390bfe12230bccaf5885427d /builtin | |
parent | sha1-file: use an object_directory for the main object dir (diff) | |
download | tgif-3a2e08245cfccd932bb3ff78521e07d4a38c2834.tar.xz |
object-store: provide helpers for loose_objects_cache
Our object_directory struct has a loose objects cache that all users of
the struct can see. But the only one that knows how to load the cache is
find_short_object_filename(). Let's extract that logic in to a reusable
function.
While we're at it, let's also reset the cache when we re-read the object
directories. This shouldn't have an impact on performance, as re-reads
are meant to be rare (and are already expensive, so we avoid them with
things like OBJECT_INFO_QUICK).
Since the cache is already meant to be an approximation, it's tempting
to skip even this bit of safety. But it's necessary to allow more code
to use it. For instance, fetch-pack explicitly re-reads the object
directory after performing its fetch, and would be confused if we didn't
clear the cache.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
0 files changed, 0 insertions, 0 deletions