1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 10:16:08 +02:00

pack: move prepare_packed_git_run_once to object store

Each repository's object store can be initialized independently, so
they must not share a run_once variable.

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:21:01 +01:00 committed by Junio C Hamano
parent d0b5986622
commit 5508f69348
2 changed files with 9 additions and 4 deletions

View File

@ -98,6 +98,12 @@ struct raw_object_store {
struct packed_git *packed_git;
/* A most-recently-used ordered version of the packed_git list. */
struct list_head packed_git_mru;
/*
* Whether packed_git has already been populated with this repository's
* packs.
*/
unsigned packed_git_initialized : 1;
};
struct raw_object_store *raw_object_store_new(void);

View File

@ -884,12 +884,11 @@ static void prepare_packed_git_mru(void)
list_add_tail(&p->mru, &the_repository->objects->packed_git_mru);
}
static int prepare_packed_git_run_once = 0;
void prepare_packed_git(void)
{
struct alternate_object_database *alt;
if (prepare_packed_git_run_once)
if (the_repository->objects->packed_git_initialized)
return;
prepare_packed_git_one(get_object_directory(), 1);
prepare_alt_odb();
@ -897,13 +896,13 @@ void prepare_packed_git(void)
prepare_packed_git_one(alt->path, 0);
rearrange_packed_git();
prepare_packed_git_mru();
prepare_packed_git_run_once = 1;
the_repository->objects->packed_git_initialized = 1;
}
void reprepare_packed_git(void)
{
approximate_object_count_valid = 0;
prepare_packed_git_run_once = 0;
the_repository->objects->packed_git_initialized = 0;
prepare_packed_git();
}