Thread (130 messages) 130 messages, 5 authors, 2018-03-26

Re: [PATCH 12/44] pack: move prepare_packed_git_run_once to object store

From: Brandon Williams <hidden>
Date: 2018-03-21 22:25:22

On 03/03, Nguyễn Thái Ngọc Duy wrote:
From: Stefan Beller <redacted>

Each repository's object store can be initialized independently, so
they must not share a run_once variable.
Looks good.
quoted hunk ↗ jump to hunk
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 object-store.h | 6 ++++++
 packfile.c     | 7 +++----
 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/object-store.h b/object-store.h
index 1f3e66a3b8..b954396615 100644
--- a/object-store.h
+++ b/object-store.h
@@ -92,6 +92,12 @@ 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;
 };
 
 void raw_object_store_init(struct raw_object_store *o);
diff --git a/packfile.c b/packfile.c
index 1e38334ba2..caeab0f68c 100644
--- a/packfile.c
+++ b/packfile.c
@@ -883,12 +883,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();
@@ -896,13 +895,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.435.g8f24da2e1a
-- 
Brandon Williams
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help