From: Jonathan Nieder <jrnieder@xxxxxxxxx> Add a repository argument to allow install_packed_git callers 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: Stefan Beller <sbeller@xxxxxxxxxx> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- fast-import.c | 2 +- http.c | 3 ++- packfile.c | 4 ++-- packfile.h | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fast-import.c b/fast-import.c index 1685fe59a2..67550584da 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1038,7 +1038,7 @@ static void end_packfile(void) if (!new_p) die("core git rejected index %s", idx_name); all_packs[pack_id] = new_p; - install_packed_git(new_p); + install_packed_git(the_repository, new_p); free(idx_name); /* Print the boundary */ diff --git a/http.c b/http.c index ab989b88dd..979d9b3e46 100644 --- a/http.c +++ b/http.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "http.h" +#include "repository.h" #include "config.h" #include "object-store.h" #include "pack.h" @@ -2068,7 +2069,7 @@ int finish_http_pack_request(struct http_pack_request *preq) return -1; } - install_packed_git(p); + install_packed_git(the_repository, p); free(tmp_idx); return 0; } diff --git a/packfile.c b/packfile.c index fbb2385bad..0f63ec79c8 100644 --- a/packfile.c +++ b/packfile.c @@ -671,7 +671,7 @@ struct packed_git *add_packed_git(const char *path, size_t path_len, int local) return p; } -void install_packed_git(struct packed_git *pack) +void install_packed_git_the_repository(struct packed_git *pack) { if (pack->pack_fd != -1) pack_open_fds++; @@ -773,7 +773,7 @@ static void prepare_packed_git_one(char *objdir, int local) * corresponding .pack file that we can map. */ (p = add_packed_git(path.buf, path.len, local)) != NULL) - install_packed_git(p); + install_packed_git(the_repository, p); } if (!report_garbage) diff --git a/packfile.h b/packfile.h index 0cdeb54dcd..7e6959d440 100644 --- a/packfile.h +++ b/packfile.h @@ -34,7 +34,8 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path); extern void prepare_packed_git(void); extern void reprepare_packed_git(void); -extern void install_packed_git(struct packed_git *pack); +#define install_packed_git(r, p) install_packed_git_##r(p) +extern void install_packed_git_the_repository(struct packed_git *pack); /* * Give a rough count of objects in the repository. This sacrifices accuracy -- 2.15.1.433.g936d1b9894.dirty