packfile: add repository argument to reprepare_packed_git
[gitweb.git] / packfile.c
index 94987634e517e83a8350d9a0870fc1da5634cc2c..210fcb3db4c016ff06e26f4e673ba8c87c434433 100644 (file)
@@ -735,7 +735,8 @@ static void report_pack_garbage(struct string_list *list)
        report_helper(list, seen_bits, first, list->nr);
 }
 
-static void prepare_packed_git_one(char *objdir, int local)
+#define prepare_packed_git_one(r, o, l) prepare_packed_git_one_##r(o, l)
+static void prepare_packed_git_one_the_repository(char *objdir, int local)
 {
        struct strbuf path = STRBUF_INIT;
        size_t dirnamelen;
@@ -816,7 +817,7 @@ unsigned long approximate_object_count(void)
                unsigned long count;
                struct packed_git *p;
 
-               prepare_packed_git();
+               prepare_packed_git(the_repository);
                count = 0;
                for (p = the_repository->objects->packed_git; p; p = p->next) {
                        if (open_pack_index(p))
@@ -883,26 +884,26 @@ static void prepare_packed_git_mru(struct repository *r)
                list_add_tail(&p->mru, &r->objects->packed_git_mru);
 }
 
-void prepare_packed_git(void)
+void prepare_packed_git_the_repository(void)
 {
        struct alternate_object_database *alt;
 
        if (the_repository->objects->packed_git_initialized)
                return;
-       prepare_packed_git_one(get_object_directory(), 1);
+       prepare_packed_git_one(the_repository, get_object_directory(), 1);
        prepare_alt_odb(the_repository);
        for (alt = the_repository->objects->alt_odb_list; alt; alt = alt->next)
-               prepare_packed_git_one(alt->path, 0);
+               prepare_packed_git_one(the_repository, alt->path, 0);
        rearrange_packed_git(the_repository);
        prepare_packed_git_mru(the_repository);
        the_repository->objects->packed_git_initialized = 1;
 }
 
-void reprepare_packed_git(void)
+void reprepare_packed_git_the_repository(void)
 {
        the_repository->objects->approximate_object_count_valid = 0;
        the_repository->objects->packed_git_initialized = 0;
-       prepare_packed_git();
+       prepare_packed_git(the_repository);
 }
 
 struct packed_git *get_packed_git(struct repository *r)
@@ -1853,7 +1854,7 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
 {
        struct list_head *pos;
 
-       prepare_packed_git();
+       prepare_packed_git(the_repository);
        if (!the_repository->objects->packed_git)
                return 0;
 
@@ -1907,7 +1908,7 @@ int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)
        int r = 0;
        int pack_errors = 0;
 
-       prepare_packed_git();
+       prepare_packed_git(the_repository);
        for (p = the_repository->objects->packed_git; p; p = p->next) {
                if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
                        continue;