Skip to content

Commit bacf168

Browse files
stefanbellergitster
authored andcommitted
commit: allow lookup_commit to handle arbitrary repositories
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f58a6cb commit bacf168

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

commit.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref
5353
return c;
5454
}
5555

56-
struct commit *lookup_commit_the_repository(const struct object_id *oid)
56+
struct commit *lookup_commit(struct repository *r, const struct object_id *oid)
5757
{
58-
struct object *obj = lookup_object(the_repository, oid->hash);
58+
struct object *obj = lookup_object(r, oid->hash);
5959
if (!obj)
60-
return create_object(the_repository, oid->hash,
61-
alloc_commit_node(the_repository));
62-
return object_as_type(the_repository, obj, OBJ_COMMIT, 0);
60+
return create_object(r, oid->hash,
61+
alloc_commit_node(r));
62+
return object_as_type(r, obj, OBJ_COMMIT, 0);
6363
}
6464

6565
struct commit *lookup_commit_reference_by_name(const char *name)

commit.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ enum decoration_type {
6363
void add_name_decoration(enum decoration_type type, const char *name, struct object *obj);
6464
const struct name_decoration *get_name_decoration(const struct object *obj);
6565

66-
#define lookup_commit(r, o) lookup_commit_##r(o)
67-
struct commit *lookup_commit_the_repository(const struct object_id *oid);
66+
struct commit *lookup_commit(struct repository *r, const struct object_id *oid);
6867
#define lookup_commit_reference(r, o) \
6968
lookup_commit_reference_##r(o)
7069
struct commit *lookup_commit_reference_the_repository(const struct object_id *oid);

0 commit comments

Comments
 (0)