commit: allow lookup_commit_graft to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
May 17, 2018 at 15:51 UTC
b9dbddf6dace2094061d5093743f29c100cfd534
2 files changed
+5
-6
commit.c
+4
-4
@@ -209,14 +209,14 @@ static void prepare_commit_graft(struct repository *r)
209
r->parsed_objects->commit_graft_prepared = 1;
210
}
211
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)
213
{
214
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);
217
if (pos < 0)
218
return NULL;
219
- return the_repository->parsed_objects->grafts[pos];
219
+ return r->parsed_objects->grafts[pos];
220
}
221
222
int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)
commit.h
+1
-2
@@ -175,8 +175,7 @@ typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *);
175
176
struct commit_graft *read_graft_line(struct strbuf *line);
177
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);
179
180
extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2);
181
extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos);