]> git.ipfire.org Git - thirdparty/git.git/commit - refs/ref-cache.c
ref-cache: use a callback function to fill the cache
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 16 Apr 2017 06:41:34 +0000 (08:41 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Apr 2017 04:32:46 +0000 (21:32 -0700)
commitdf30875987329bb46e54ec7be0eb29c33702de3a
tree6c2f92e2dbadf9554198da881f9ac002210d4565
parente00d1a4ff7d79b403bf97a0746138d584c9ebf9a
ref-cache: use a callback function to fill the cache

It is a leveling violation for `ref_cache` to know about
`files_ref_store` or that it should call `read_loose_refs()` to lazily
fill cache directories. So instead, have its constructor take as an
argument a callback function that it should use for lazy-filling, and
change `files_ref_store` to supply a pointer to function
`read_loose_refs` (renamed to `loose_fill_ref_dir`) when creating the
ref cache for its loose refs.

This means that we can generify the type of the back-pointer in
`struct ref_cache` from `files_ref_store` to `ref_store`.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c
refs/ref-cache.c
refs/ref-cache.h