aboutsummaryrefslogtreecommitdiffstats
path: root/commit.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-05-17 15:51:53 -0700
committerJunio C Hamano <gitster@pobox.com>2018-05-18 08:13:10 +0900
commit2f6c767fd49a1fb324c2d19fcee1fe227d816e11 (patch)
tree1461a50478b84508df585b20f3d4e69ac670b0ef /commit.c
parenteee4502baaf8f82c20bcda70625df56ce68dd9b1 (diff)
downloadgit-2f6c767fd49a1fb324c2d19fcee1fe227d816e11.tar.gz
commit: allow prepare_commit_graft to handle arbitrary repositories
Move the global variable 'commit_graft_prepared' into the object pool and convert the function prepare_commit_graft to work an arbitrary repositories. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/commit.c b/commit.c
index 24028fd257..eef1675d69 100644
--- a/commit.c
+++ b/commit.c
@@ -196,19 +196,17 @@ static int read_graft_file(struct repository *r, const char *graft_file)
return 0;
}
-#define prepare_commit_graft(r) prepare_commit_graft_##r()
-static void prepare_commit_graft_the_repository(void)
+static void prepare_commit_graft(struct repository *r)
{
- static int commit_graft_prepared;
char *graft_file;
- if (commit_graft_prepared)
+ if (r->parsed_objects->commit_graft_prepared)
return;
- graft_file = get_graft_file(the_repository);
- read_graft_file(the_repository, graft_file);
+ graft_file = get_graft_file(r);
+ read_graft_file(r, graft_file);
/* make sure shallows are read */
- is_repository_shallow(the_repository);
- commit_graft_prepared = 1;
+ is_repository_shallow(r);
+ r->parsed_objects->commit_graft_prepared = 1;
}
struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid)