replace-object: allow prepare_replace_object to handle arbitrary repositories
authorStefan Beller <sbeller@google.com>
Thu, 12 Apr 2018 00:21:16 +0000 (17:21 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Apr 2018 02:38:57 +0000 (11:38 +0900)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
replace_object.c
index adfed789014bfe88b8a376983a77095c4622e852..eae52c66f3f69d0a39da5c3761467ae422af5ea5 100644 (file)
@@ -31,18 +31,16 @@ static int register_replace_ref(const char *refname,
        return 0;
 }
 
-#define prepare_replace_object(r) \
-       prepare_replace_object_##r()
-static void prepare_replace_object_the_repository(void)
+static void prepare_replace_object(struct repository *r)
 {
-       if (the_repository->objects->replace_map)
+       if (r->objects->replace_map)
                return;
 
-       the_repository->objects->replace_map =
+       r->objects->replace_map =
                xmalloc(sizeof(*the_repository->objects->replace_map));
-       oidmap_init(the_repository->objects->replace_map, 0);
+       oidmap_init(r->objects->replace_map, 0);
 
-       for_each_replace_ref(the_repository, register_replace_ref, NULL);
+       for_each_replace_ref(r, register_replace_ref, NULL);
 }
 
 /* We allow "recursive" replacement. Only within reason, though */