Skip to content
  • Jeff King's avatar
    object-store: provide helpers for loose_objects_cache · 3a2e0824
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    3a2e0824