packfile: keep prepare_packed_git() private

The reason callers have to call this is to make sure either packed_git
or packed_git_mru pointers are initialized since we don't do that by
default. Sometimes it's hard to see this connection between where the
function is called and where packed_git pointer is used (sometimes in
separate functions).

Keep this dependency internal because now all access to packed_git and
packed_git_mru must go through get_xxx() wrappers.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2018-03-23 18:45:27 +01:00
committed by Junio C Hamano
parent 0a0dd632aa
commit 464416a2ea
12 changed files with 5 additions and 16 deletions

View File

@ -122,8 +122,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
struct strbuf loose_buf = STRBUF_INIT;
struct strbuf pack_buf = STRBUF_INIT;
struct strbuf garbage_buf = STRBUF_INIT;
if (!get_packed_git(the_repository))
prepare_packed_git(the_repository);
for (p = get_packed_git(the_repository); p; p = p->next) {
if (!p->pack_local)
continue;