diff options
author | René Scharfe <l.s.r@web.de> | 2019-01-07 18:29:16 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-08 18:40:19 +0100 |
commit | 8be88dbcb1322df53c41c496bf718c5564c82bfb (patch) | |
tree | cfdab85c5073d450ad2386d634cced2ac3007c41 /sha1-file.c | |
parent | object-store: use one oid_array per subdirectory for loose cache (diff) | |
download | git-8be88dbcb1322df53c41c496bf718c5564c82bfb.tar.xz git-8be88dbcb1322df53c41c496bf718c5564c82bfb.zip |
object-store: retire odb_load_loose_cache()
Inline odb_load_loose_cache() into its only remaining caller,
odb_loose_cache(). The latter offers a nicer interface for loading the
cache, as it doesn't require callers to deal with fanout directory
numbers directly.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | sha1-file.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sha1-file.c b/sha1-file.c index c3c6e50704..efcb2cbe74 100644 --- a/sha1-file.c +++ b/sha1-file.c @@ -2154,12 +2154,6 @@ struct oid_array *odb_loose_cache(struct object_directory *odb, const struct object_id *oid) { int subdir_nr = oid->hash[0]; - odb_load_loose_cache(odb, subdir_nr); - return &odb->loose_objects_cache[subdir_nr]; -} - -void odb_load_loose_cache(struct object_directory *odb, int subdir_nr) -{ struct strbuf buf = STRBUF_INIT; if (subdir_nr < 0 || @@ -2167,7 +2161,7 @@ void odb_load_loose_cache(struct object_directory *odb, int subdir_nr) BUG("subdir_nr out of range"); if (odb->loose_objects_subdir_seen[subdir_nr]) - return; + return &odb->loose_objects_cache[subdir_nr]; strbuf_addstr(&buf, odb->path); for_each_file_in_obj_subdir(subdir_nr, &buf, @@ -2176,6 +2170,7 @@ void odb_load_loose_cache(struct object_directory *odb, int subdir_nr) &odb->loose_objects_cache[subdir_nr]); odb->loose_objects_subdir_seen[subdir_nr] = 1; strbuf_release(&buf); + return &odb->loose_objects_cache[subdir_nr]; } void odb_clear_loose_cache(struct object_directory *odb) |