commit: convert commit_graft_pos() to handle arbitrary repositories

Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed May 17, 2018 at 15:51 UTC e808656c46e9d0e2e446b304a6f4d1f7dd0b25b5
1 file changed +3 -4
commit.c
+3 -4
@@ -104,11 +104,10 @@ static const unsigned char *commit_graft_sha1_access(size_t index, void *table)
104 return commit_graft_table[index]->oid.hash;
105 }
106
107 -#define commit_graft_pos(r, s) commit_graft_pos_##r(s)
108 -static int commit_graft_pos_the_repository(const unsigned char *sha1)
107 +static int commit_graft_pos(struct repository *r, const unsigned char *sha1)
108 {
110 - return sha1_pos(sha1, the_repository->parsed_objects->grafts,
111 - the_repository->parsed_objects->grafts_nr,
109 + return sha1_pos(sha1, r->parsed_objects->grafts,
110 + r->parsed_objects->grafts_nr,
111 commit_graft_sha1_access);
112 }
113