object-store: move lookup_replace_object to replace-object.h
lookup_replace_object is a low-level function that most users of the object store do not need to use directly. Move it to replace-object.h to avoid a dependency loop in an upcoming change to its inline definition that will make use of repository.h. 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>
Stefan Beller committed
Apr 11, 2018 at 17:21 UTC
47f351e9b328cd828d85c45a736eca252152aa5c
6 files changed
+26
-19
builtin/mktag.c
+1
@@ -1,5 +1,6 @@
1
#include "builtin.h"
2
#include "tag.h"
3
+#include "replace-object.h"
4
5
/*
6
* A signature file has a very simple fixed format: four lines
cache.h
-19
@@ -1191,25 +1191,6 @@ static inline void *read_object_file(const struct object_id *oid, enum object_ty
1191
return read_object_file_extended(oid, type, size, 1);
1192
}
1193
1194
-/*
1195
- * This internal function is only declared here for the benefit of
1196
- * lookup_replace_object(). Please do not call it directly.
1197
- */
1198
-extern const struct object_id *do_lookup_replace_object(const struct object_id *oid);
1199
-
1200
-/*
1201
- * If object sha1 should be replaced, return the replacement object's
1202
- * name (replaced recursively, if necessary). The return value is
1203
- * either sha1 or a pointer to a permanently-allocated value. When
1204
- * object replacement is suppressed, always return sha1.
1205
- */
1206
-static inline const struct object_id *lookup_replace_object(const struct object_id *oid)
1207
-{
1208
- if (!check_replace_refs)
1209
- return oid;
1210
- return do_lookup_replace_object(oid);
1211
-}
1212
-
1194
/* Read and unpack an object file into memory, write memory to an object file */
1195
extern int oid_object_info(const struct object_id *, unsigned long *);
1196
object.c
+1
@@ -1,5 +1,6 @@
1
#include "cache.h"
2
#include "object.h"
3
+#include "replace-object.h"
4
#include "blob.h"
5
#include "tree.h"
6
#include "commit.h"
replace-object.h
+22
@@ -1,9 +1,31 @@
1
#ifndef REPLACE_OBJECT_H
2
#define REPLACE_OBJECT_H
3
4
+#include "oidmap.h"
5
+#include "repository.h"
6
+
7
struct replace_object {
8
struct oidmap_entry original;
9
struct object_id replacement;
10
};
11
12
+/*
13
+ * This internal function is only declared here for the benefit of
14
+ * lookup_replace_object(). Please do not call it directly.
15
+ */
16
+extern const struct object_id *do_lookup_replace_object(const struct object_id *oid);
17
+
18
+/*
19
+ * If object sha1 should be replaced, return the replacement object's
20
+ * name (replaced recursively, if necessary). The return value is
21
+ * either sha1 or a pointer to a permanently-allocated value. When
22
+ * object replacement is suppressed, always return sha1.
23
+ */
24
+static inline const struct object_id *lookup_replace_object(const struct object_id *oid)
25
+{
26
+ if (!check_replace_refs)
27
+ return oid;
28
+ return do_lookup_replace_object(oid);
29
+}
30
+
31
#endif /* REPLACE_OBJECT_H */
sha1_file.c
+1
@@ -23,6 +23,7 @@
23
#include "sha1-lookup.h"
24
#include "bulk-checkin.h"
25
#include "repository.h"
26
+#include "replace-object.h"
27
#include "streaming.h"
28
#include "dir.h"
29
#include "list.h"
streaming.c
+1
@@ -5,6 +5,7 @@
5
#include "streaming.h"
6
#include "repository.h"
7
#include "object-store.h"
8
+#include "replace-object.h"
9
#include "packfile.h"
10
11
enum input_source {