object-store: move packed_git and packed_git_mru to object store

In a process with multiple repositories open, packfile accessors
should be associated to a single repository and not shared globally.
Move packed_git and packed_git_mru into the_repository and adjust
callers to reflect this.

[nd: while at there, wrap access to these two fields in get_packed_git()
and get_packed_git_mru(). This allows us to lazily initialize these
fields without caller doing that explicitly]

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
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:
Stefan Beller
2018-03-23 18:20:59 +01:00
committed by Junio C Hamano
parent 97501e933a
commit a80d72db2a
22 changed files with 128 additions and 74 deletions

View File

@ -732,7 +732,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
prepare_packed_git();
if (show_progress) {
for (p = packed_git; p; p = p->next) {
for (p = get_packed_git(the_repository); p;
p = p->next) {
if (open_pack_index(p))
continue;
total += p->num_objects;
@ -740,7 +741,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
progress = start_progress(_("Checking objects"), total);
}
for (p = packed_git; p; p = p->next) {
for (p = get_packed_git(the_repository); p;
p = p->next) {
/* verify gives error messages itself */
if (verify_pack(p, fsck_obj_buffer,
progress, count))