commit: add repository argument to prepare_commit_graft
Add a repository argument to allow the caller of prepare_commit_graft to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
May 15, 2018 at 16:42 UTC
3ee37656ee6e6c2510add974af057a9d02d3cf4a
1 file changed
+3
-2
commit.c
+3
-2
@@ -197,7 +197,8 @@ static int read_graft_file_the_repository(const char *graft_file)
197
return 0;
198
}
199
200
-static void prepare_commit_graft(void)
200
+#define prepare_commit_graft(r) prepare_commit_graft_##r()
201
+static void prepare_commit_graft_the_repository(void)
202
{
203
static int commit_graft_prepared;
204
char *graft_file;
@@ -214,7 +215,7 @@ static void prepare_commit_graft(void)
215
struct commit_graft *lookup_commit_graft(const struct object_id *oid)
216
{
217
int pos;
217
- prepare_commit_graft();
218
+ prepare_commit_graft(the_repository);
219
pos = commit_graft_pos(the_repository, oid->hash);
220
if (pos < 0)
221
return NULL;