Web lists-archives.com

[PATCH 046/194] object-store: move replace_objects back to object-store




From: Jonathan Nieder <jrnieder@xxxxxxxxx>

This way, object-store.h does not need to #include replace-object.h,
avoiding a header dependency loop in an upcoming change to the inline
definition of the lookup_replace_object function.

Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 object-store.h   | 13 ++++++++++---
 replace-object.h | 11 -----------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/object-store.h b/object-store.h
index 31628c49dc..cf06a54782 100644
--- a/object-store.h
+++ b/object-store.h
@@ -3,7 +3,6 @@
 
 #include "strbuf.h"
 #include "mru.h"
-#include "replace-object.h"
 #include "alternates.h"
 
 /* in packfile.h */
@@ -32,7 +31,15 @@ struct object_store {
 	 * Objects that should be substituted by other objects
 	 * (see git-replace(1)).
 	 */
-	struct replace_objects replacements;
+	struct replace_objects {
+		/*
+		 * An array of replacements.  The array is kept sorted by the original
+		 * sha1.
+		 */
+		struct replace_object **items;
+
+		int alloc, nr;
+	} replacements;
 
 	/*
 	 * A fast, rough count of the number of objects in the repository.
@@ -49,7 +56,7 @@ struct object_store {
 	unsigned packed_git_initialized : 1;
 };
 #define OBJECT_STORE_INIT \
-	{ NULL, MRU_INIT, ALTERNATES_INIT, REPLACE_OBJECTS_INIT, 0, 0, 0 }
+	{ NULL, MRU_INIT, ALTERNATES_INIT, { NULL, 0, 0 }, 0, 0, 0 }
 
 struct packed_git {
 	struct packed_git *next;
diff --git a/replace-object.h b/replace-object.h
index 483335ffcc..e05713b951 100644
--- a/replace-object.h
+++ b/replace-object.h
@@ -1,17 +1,6 @@
 #ifndef REPLACE_OBJECT_H
 #define REPLACE_OBJECT_H
 
-struct replace_objects {
-	/*
-	 * An array of replacements.  The array is kept sorted by the original
-	 * sha1.
-	 */
-	struct replace_object **items;
-
-	int alloc, nr;
-};
-#define REPLACE_OBJECTS_INIT { NULL, 0, 0 }
-
 struct replace_object {
 	unsigned char original[20];
 	unsigned char replacement[20];
-- 
2.15.1.433.g936d1b9894.dirty