commit: convert read_graft_file 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 d0e5dd0ed49a8e79dab8a027ab14ee29709b47c6
1 file changed +2 -3
commit.c
+2 -3
@@ -177,8 +177,7 @@ bad_graft_data:
177 return NULL;
178 }
179
180 -#define read_graft_file(r, f) read_graft_file_##r(f)
181 -static int read_graft_file_the_repository(const char *graft_file)
180 +static int read_graft_file(struct repository *r, const char *graft_file)
181 {
182 FILE *fp = fopen_or_warn(graft_file, "r");
183 struct strbuf buf = STRBUF_INIT;
@@ -189,7 +188,7 @@ static int read_graft_file_the_repository(const char *graft_file)
188 struct commit_graft *graft = read_graft_line(&buf);
189 if (!graft)
190 continue;
192 - if (register_commit_graft(the_repository, graft, 1))
191 + if (register_commit_graft(r, graft, 1))
192 error("duplicate graft data: %s", buf.buf);
193 }
194 fclose(fp);