replace-object: add repository argument to prepare_replace_object

Add a repository argument to allow the prepare_replace_object caller to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Apr 11, 2018 at 17:21 UTC fe6d34d863a351034cbc7c756465f84dc64007ad
1 file changed +4 -2
replace_object.c
+4 -2
@@ -31,7 +31,9 @@ static int register_replace_ref(const char *refname,
31 return 0;
32 }
33
34 -static void prepare_replace_object(void)
34 +#define prepare_replace_object(r) \
35 + prepare_replace_object_##r()
36 +static void prepare_replace_object_the_repository(void)
37 {
38 if (the_repository->objects->replace_map)
39 return;
@@ -58,7 +60,7 @@ const struct object_id *do_lookup_replace_object(const struct object_id *oid)
60 int depth = MAXREPLACEDEPTH;
61 const struct object_id *cur = oid;
62
61 - prepare_replace_object();
63 + prepare_replace_object(the_repository);
64
65 /* Try to recursively replace the object */
66 while (depth-- > 0) {