diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2017-08-29 23:54:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-07 08:49:44 +0900 |
commit | 14759b6f4e35da48b1595bb87f9b1c4b06b472a5 (patch) | |
tree | 3246b404b692644f2dd71054c9367cfb7364a3a6 | |
parent | 3ce7edf13594c07d423a3a0efa5a6b52c3308ec7 (diff) | |
download | git-14759b6f4e35da48b1595bb87f9b1c4b06b472a5.tar.gz |
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: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | object-store.h | 8 | ||||
-rw-r--r-- | packfile.c | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/object-store.h b/object-store.h index e2a59a0611..14129fbba1 100644 --- a/object-store.h +++ b/object-store.h @@ -15,8 +15,14 @@ struct 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 OBJECT_STORE_INIT { NULL, MRU_INIT, NULL, NULL } +#define OBJECT_STORE_INIT { NULL, MRU_INIT, NULL, NULL, 0 } struct packed_git { struct packed_git *next; diff --git a/packfile.c b/packfile.c index 57260a9b34..c54fe0ac1c 100644 --- a/packfile.c +++ b/packfile.c @@ -866,12 +866,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(); @@ -879,13 +878,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(); } |