commit: add repository argument to read_graft_file
Add a repository argument to allow the caller of read_graft_file 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
02ba3e1a057aad2d2201dc6ba8f77f2904b07703
1 file changed
+3
-2
commit.c
+3
-2
@@ -177,7 +177,8 @@ bad_graft_data:
177
return NULL;
178
}
179
180
-static int read_graft_file(const char *graft_file)
180
+#define read_graft_file(r, f) read_graft_file_##r(f)
181
+static int read_graft_file_the_repository(const char *graft_file)
182
{
183
FILE *fp = fopen_or_warn(graft_file, "r");
184
struct strbuf buf = STRBUF_INIT;
@@ -204,7 +205,7 @@ static void prepare_commit_graft(void)
205
if (commit_graft_prepared)
206
return;
207
graft_file = get_graft_file();
207
- read_graft_file(graft_file);
208
+ read_graft_file(the_repository, graft_file);
209
/* make sure shallows are read */
210
is_repository_shallow();
211
commit_graft_prepared = 1;