summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Stefan Beller <sbeller@google.com>2018-04-11 17:21:16 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-04-12 11:38:57 +0900
commit5982da9d2ce75d445cb2a74351c34efa07342ea2 (patch)
tree5a65b5fe0fd295d468e08895d04afc1d4b8c5050
parentrefs: allow for_each_replace_ref to handle arbitrary repositories (diff)
downloadtgif-5982da9d2ce75d445cb2a74351c34efa07342ea2.tar.xz
replace-object: allow prepare_replace_object to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--replace_object.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/replace_object.c b/replace_object.c
index adfed78901..eae52c66f3 100644
--- a/replace_object.c
+++ b/replace_object.c
@@ -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 */