[PATCH 12/27] sha1_file: add repository argument to link_alt_odb_entries
From: Stefan Beller See previous patch for explanation. Signed-off-by: Stefan Beller Signed-off-by: Jonathan Nieder Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1_file.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index 81ad2a84f2..ba4fc9103b 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -468,8 +468,12 @@ static const char *parse_alt_odb_entry(const char *string, return end; } -static void link_alt_odb_entries(const char *alt, int sep, -const char *relative_base, int depth) +#define link_alt_odb_entries(r, a, s, rb, d) \ + link_alt_odb_entries_##r(a, s, rb, d) +static void link_alt_odb_entries_the_repository(const char *alt, + int sep, + const char *relative_base, + int depth) { struct strbuf objdirbuf = STRBUF_INIT; struct strbuf entry = STRBUF_INIT; @@ -512,7 +516,7 @@ static void read_info_alternates_the_repository(const char *relative_base, return; } - link_alt_odb_entries(buf.buf, '\n', relative_base, depth); + link_alt_odb_entries(the_repository, buf.buf, '\n', relative_base, depth); strbuf_release(&buf); free(path); } @@ -566,7 +570,8 @@ void add_to_alternates_file(const char *reference) if (commit_lock_file(&lock)) die_errno("unable to move new alternates file into place"); if (the_repository->objects->alt_odb_tail) - link_alt_odb_entries(reference, '\n', NULL, 0); + link_alt_odb_entries(the_repository, reference, +'\n', NULL, 0); } free(alts); } @@ -579,7 +584,8 @@ void add_to_alternates_memory(const char *reference) */ prepare_alt_odb(); - link_alt_odb_entries(reference, '\n', NULL, 0); + link_alt_odb_entries(the_repository, reference, +'\n', NULL, 0); } /* @@ -678,7 +684,8 @@ void prepare_alt_odb(void) the_repository->objects->alt_odb_tail = &the_repository->objects->alt_odb_list; - link_alt_odb_entries(the_repository->objects->alternate_db, + link_alt_odb_entries(the_repository, +the_repository->objects->alternate_db, PATH_SEP, NULL, 0); read_info_alternates(the_repository, get_object_directory(), 0); -- 2.17.0.rc0.348.gd5a49e0b6f
[PATCH 12/27] sha1_file: add repository argument to link_alt_odb_entries
See previous patch for explanation. Signed-off-by: Stefan Beller Signed-off-by: Jonathan Nieder --- sha1_file.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sha1_file.c b/sha1_file.c index 6edcc3d3a7..a0e9116318 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -467,8 +467,12 @@ static const char *parse_alt_odb_entry(const char *string, return end; } -static void link_alt_odb_entries(const char *alt, int sep, -const char *relative_base, int depth) +#define link_alt_odb_entries(r, a, s, rb, d) \ + link_alt_odb_entries_##r(a, s, rb, d) +static void link_alt_odb_entries_the_repository(const char *alt, + int sep, + const char *relative_base, + int depth) { struct strbuf objdirbuf = STRBUF_INIT; struct strbuf entry = STRBUF_INIT; @@ -511,7 +515,7 @@ static void read_info_alternates_the_repository(const char *relative_base, return; } - link_alt_odb_entries(buf.buf, '\n', relative_base, depth); + link_alt_odb_entries(the_repository, buf.buf, '\n', relative_base, depth); strbuf_release(&buf); free(path); } @@ -565,7 +569,8 @@ void add_to_alternates_file(const char *reference) if (commit_lock_file(&lock)) die_errno("unable to move new alternates file into place"); if (the_repository->objects.alt_odb_tail) - link_alt_odb_entries(reference, '\n', NULL, 0); + link_alt_odb_entries(the_repository, reference, +'\n', NULL, 0); } free(alts); } @@ -578,7 +583,8 @@ void add_to_alternates_memory(const char *reference) */ prepare_alt_odb(); - link_alt_odb_entries(reference, '\n', NULL, 0); + link_alt_odb_entries(the_repository, reference, +'\n', NULL, 0); } /* @@ -681,7 +687,8 @@ void prepare_alt_odb(void) the_repository->objects.alt_odb_tail = &the_repository->objects.alt_odb_list; - link_alt_odb_entries(alt, PATH_SEP, NULL, 0); + link_alt_odb_entries(the_repository, alt, +PATH_SEP, NULL, 0); read_info_alternates(the_repository, get_object_directory(), 0); } -- 2.16.1.291.g4437f3f132-goog