object-store: factor out odb_clear_loose_cache()

Add and use a function for emptying the loose object cache, so callers
don't have to know any of its implementation details.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2019-01-06 17:45:39 +01:00
committed by Junio C Hamano
parent 0000d6543f
commit d4e19e5163
4 changed files with 13 additions and 6 deletions

View File

@ -2178,6 +2178,13 @@ void odb_load_loose_cache(struct object_directory *odb, int subdir_nr)
strbuf_release(&buf);
}
void odb_clear_loose_cache(struct object_directory *odb)
{
oid_array_clear(&odb->loose_objects_cache);
memset(&odb->loose_objects_subdir_seen, 0,
sizeof(odb->loose_objects_subdir_seen));
}
static int check_stream_sha1(git_zstream *stream,
const char *hdr,
unsigned long size,