Skip to content

Commit 5643557

Browse files
stefanbellergitster
authored andcommitted
replace-object: allow do_lookup_replace_object to handle arbitrary repositories
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5982da9 commit 5643557

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

replace-object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ struct replace_object {
1414
* This internal function is only declared here for the benefit of
1515
* lookup_replace_object(). Please do not call it directly.
1616
*/
17-
#define do_lookup_replace_object(r, s) do_lookup_replace_object_##r(s)
18-
extern const struct object_id *do_lookup_replace_object_the_repository(const struct object_id *oid);
17+
extern const struct object_id *do_lookup_replace_object(struct repository *r,
18+
const struct object_id *oid);
1919

2020
/*
2121
* If object sha1 should be replaced, return the replacement object's

replace_object.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,18 @@ static void prepare_replace_object(struct repository *r)
5353
* permanently-allocated value. This function always respects replace
5454
* references, regardless of the value of check_replace_refs.
5555
*/
56-
const struct object_id *do_lookup_replace_object_the_repository(const struct object_id *oid)
56+
const struct object_id *do_lookup_replace_object(struct repository *r,
57+
const struct object_id *oid)
5758
{
5859
int depth = MAXREPLACEDEPTH;
5960
const struct object_id *cur = oid;
6061

61-
prepare_replace_object(the_repository);
62+
prepare_replace_object(r);
6263

6364
/* Try to recursively replace the object */
6465
while (depth-- > 0) {
6566
struct replace_object *repl_obj =
66-
oidmap_get(the_repository->objects->replace_map, cur);
67+
oidmap_get(r->objects->replace_map, cur);
6768
if (!repl_obj)
6869
return cur;
6970
cur = &repl_obj->replacement;

0 commit comments

Comments
 (0)