Skip to content

Commit b9dbddf

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

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

commit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ static void prepare_commit_graft(struct repository *r)
209209
r->parsed_objects->commit_graft_prepared = 1;
210210
}
211211

212-
struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid)
212+
struct commit_graft *lookup_commit_graft(struct repository *r, const struct object_id *oid)
213213
{
214214
int pos;
215-
prepare_commit_graft(the_repository);
216-
pos = commit_graft_pos(the_repository, oid->hash);
215+
prepare_commit_graft(r);
216+
pos = commit_graft_pos(r, oid->hash);
217217
if (pos < 0)
218218
return NULL;
219-
return the_repository->parsed_objects->grafts[pos];
219+
return r->parsed_objects->grafts[pos];
220220
}
221221

222222
int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)

commit.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *);
175175

176176
struct commit_graft *read_graft_line(struct strbuf *line);
177177
int register_commit_graft(struct repository *r, struct commit_graft *, int);
178-
#define lookup_commit_graft(r, o) lookup_commit_graft_##r(o)
179-
struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid);
178+
struct commit_graft *lookup_commit_graft(struct repository *r, const struct object_id *oid);
180179

181180
extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2);
182181
extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos);

0 commit comments

Comments
 (0)