[PATCH 06/26] pack: move prepare_packed_git_run_once to object store
From: Stefan Beller <hidden>
Date: 2018-02-13 01:24:00
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Jonathan Nieder <redacted> Each repository's object store can be initialized independently, so they must not share a run_once variable. Signed-off-by: Stefan Beller <redacted> Signed-off-by: Jonathan Nieder <redacted> --- object-store.h | 8 +++++++- packfile.c | 7 +++---- 2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/object-store.h b/object-store.h
index 8778ab9685..9fd109fa9c 100644
--- a/object-store.h
+++ b/object-store.h@@ -20,8 +20,14 @@ struct raw_object_store { struct alternate_object_database *alt_odb_list; struct alternate_object_database **alt_odb_tail; + + /* + * Whether packed_git has already been populated with this repository's + * packs. + */ + unsigned packed_git_initialized : 1; }; -#define RAW_OBJECT_STORE_INIT { NULL, NULL, MRU_INIT, NULL, NULL } +#define RAW_OBJECT_STORE_INIT { NULL, NULL, MRU_INIT, NULL, NULL, 0 } void raw_object_store_clear(struct raw_object_store *o);
diff --git a/packfile.c b/packfile.c
index 2ce1b2cef7..c107fce171 100644
--- a/packfile.c
+++ b/packfile.c@@ -873,12 +873,11 @@ static void prepare_packed_git_mru(void) mru_append(&the_repository->objects.packed_git_mru, p); } -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();
@@ -886,13 +885,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(); }
--
2.16.1.73.ga2c3e9663f.dirty