submodule: fixup nested submodules after moving the submodule
[gitweb.git] / packfile.c
index b56ed10b68ac54eda414b673b65a1a3df04ae9e9..d087eacc066761d8b583939eb0db993cc5f31dbc 100644 (file)
@@ -311,11 +311,11 @@ static void close_pack(struct packed_git *p)
        close_pack_index(p);
 }
 
-void close_all_packs(void)
+void close_all_packs(struct raw_object_store *o)
 {
        struct packed_git *p;
 
-       for (p = the_repository->objects->packed_git; p; p = p->next)
+       for (p = o->packed_git; p; p = p->next)
                if (p->do_not_close)
                        die("BUG: want to close pack marked 'do-not-close'");
                else
@@ -803,8 +803,6 @@ static void prepare_packed_git_one(char *objdir, int local)
        strbuf_release(&path);
 }
 
-static int approximate_object_count_valid;
-
 /*
  * Give a fast, rough count of the number of objects in the repository. This
  * ignores loose objects completely. If you have a lot of them, then either
@@ -814,8 +812,8 @@ static int approximate_object_count_valid;
  */
 unsigned long approximate_object_count(void)
 {
-       static unsigned long count;
-       if (!approximate_object_count_valid) {
+       if (!the_repository->objects->approximate_object_count_valid) {
+               unsigned long count;
                struct packed_git *p;
 
                prepare_packed_git();
@@ -825,8 +823,9 @@ unsigned long approximate_object_count(void)
                                continue;
                        count += p->num_objects;
                }
+               the_repository->objects->approximate_object_count = count;
        }
-       return count;
+       return the_repository->objects->approximate_object_count;
 }
 
 static void *get_next_packed_git(const void *p)
@@ -884,26 +883,25 @@ static void prepare_packed_git_mru(void)
                list_add_tail(&p->mru, &the_repository->objects->packed_git_mru);
 }
 
-static int prepare_packed_git_run_once = 0;
 void prepare_packed_git(void)
 {
        struct alternate_object_database *alt;
 
-       if (prepare_packed_git_run_once)
+       if (the_repository->objects->packed_git_initialized)
                return;
        prepare_packed_git_one(get_object_directory(), 1);
-       prepare_alt_odb();
+       prepare_alt_odb(the_repository);
        for (alt = the_repository->objects->alt_odb_list; alt; alt = alt->next)
                prepare_packed_git_one(alt->path, 0);
        rearrange_packed_git();
        prepare_packed_git_mru();
-       prepare_packed_git_run_once = 1;
+       the_repository->objects->packed_git_initialized = 1;
 }
 
 void reprepare_packed_git(void)
 {
-       approximate_object_count_valid = 0;
-       prepare_packed_git_run_once = 0;
+       the_repository->objects->approximate_object_count_valid = 0;
+       the_repository->objects->packed_git_initialized = 0;
        prepare_packed_git();
 }