commit_graft_sha1_access);
}
-int register_commit_graft(struct commit_graft *graft, int ignore_dups)
+int register_commit_graft_the_repository(struct commit_graft *graft, int ignore_dups)
{
int pos = commit_graft_pos(the_repository, graft->oid.hash);
return NULL;
}
-static int read_graft_file(const char *graft_file)
+#define read_graft_file(r, f) read_graft_file_##r(f)
+static int read_graft_file_the_repository(const char *graft_file)
{
FILE *fp = fopen_or_warn(graft_file, "r");
struct strbuf buf = STRBUF_INIT;
struct commit_graft *graft = read_graft_line(&buf);
if (!graft)
continue;
- if (register_commit_graft(graft, 1))
+ if (register_commit_graft(the_repository, graft, 1))
error("duplicate graft data: %s", buf.buf);
}
fclose(fp);
return 0;
}
-static void prepare_commit_graft(void)
+#define prepare_commit_graft(r) prepare_commit_graft_##r()
+static void prepare_commit_graft_the_repository(void)
{
static int commit_graft_prepared;
char *graft_file;
if (commit_graft_prepared)
return;
graft_file = get_graft_file();
- read_graft_file(graft_file);
+ read_graft_file(the_repository, graft_file);
/* make sure shallows are read */
is_repository_shallow();
commit_graft_prepared = 1;
struct commit_graft *lookup_commit_graft(const struct object_id *oid)
{
int pos;
- prepare_commit_graft();
+ prepare_commit_graft(the_repository);
pos = commit_graft_pos(the_repository, oid->hash);
if (pos < 0)
return NULL;