summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2017-08-30 00:02:50 -0700
committerJunio C Hamano <gitster@pobox.com>2017-09-07 08:49:45 +0900
commit9da1128049b04d9088c94e512c2a8bf9d6ccf403 (patch)
tree214e1acfb0fa45d73f09e052e48bef857d3fa996
parentc913d55a08fefe01abafb7205f7ea4ad6e0bd633 (diff)
downloadgit-9da1128049b04d9088c94e512c2a8bf9d6ccf403.tar.gz
pack: add repository argument to install_packed_git
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@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--fast-import.c2
-rw-r--r--http.c3
-rw-r--r--packfile.c4
-rw-r--r--packfile.h3
4 files changed, 7 insertions, 5 deletions
diff --git a/fast-import.c b/fast-import.c
index 9a725ebf4f..4c3b3d9df6 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 3186de107b..0979053272 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"
@@ -2049,7 +2050,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 2cd61b32a3..cea3698af5 100644
--- a/packfile.c
+++ b/packfile.c
@@ -664,7 +664,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++;
@@ -766,7 +766,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