From 212e0f7efe163d062dcd393a0788cf3f93544a6e Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Mon, 20 Aug 2018 18:24:19 +0000 Subject: refs.c: upgrade for_each_replace_ref to be a each_repo_ref_fn callback Signed-off-by: Stefan Beller Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- replace-object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'replace-object.c') diff --git a/replace-object.c b/replace-object.c index 4162df6324..3c17864eb7 100644 --- a/replace-object.c +++ b/replace-object.c @@ -6,7 +6,8 @@ #include "repository.h" #include "commit.h" -static int register_replace_ref(const char *refname, +static int register_replace_ref(struct repository *r, + const char *refname, const struct object_id *oid, int flag, void *cb_data) { @@ -25,7 +26,7 @@ static int register_replace_ref(const char *refname, oidcpy(&repl_obj->replacement, oid); /* Register new object */ - if (oidmap_put(the_repository->objects->replace_map, repl_obj)) + if (oidmap_put(r->objects->replace_map, repl_obj)) die("duplicate replace ref: %s", refname); return 0; -- cgit v1.2.3 From d6538246d3d4edbfbc9b0af6a2aa38552d35f7f1 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 20 Aug 2018 18:24:27 +0000 Subject: commit-graph: not compatible with replace objects Create new method commit_graph_compatible(r) to check if a given repository r is compatible with the commit-graph feature. Fill the method with a check to see if replace-objects exist. Test this interaction succeeds, including ignoring an existing commit-graph and failing to write a new commit-graph. However, we do ensure that we write a new commit-graph by setting read_replace_refs to 0, thereby ignoring the replace refs. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- replace-object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'replace-object.c') diff --git a/replace-object.c b/replace-object.c index 3c17864eb7..9821f1477e 100644 --- a/replace-object.c +++ b/replace-object.c @@ -32,7 +32,7 @@ static int register_replace_ref(struct repository *r, return 0; } -static void prepare_replace_object(struct repository *r) +void prepare_replace_object(struct repository *r) { if (r->objects->replace_map) return; -- cgit v1.2.3