packfile: add repository argument to reprepare_packed_git
authorStefan Beller <sbeller@google.com>
Fri, 23 Mar 2018 17:45:21 +0000 (18:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Mar 2018 17:07:43 +0000 (10:07 -0700)
See previous patch for explanation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
builtin/receive-pack.c
bulk-checkin.c
fetch-pack.c
packfile.c
packfile.h
sha1_file.c
index 4c7409946edc47a5bb1a2165a104250aea6f137d..a78dad51aa128f28f2f2a8028710b14597157e65 100644 (file)
@@ -478,7 +478,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                return error(FAILED_RUN, rerere.argv[0]);
 
        report_garbage = report_pack_garbage;
-       reprepare_packed_git();
+       reprepare_packed_git(the_repository);
        if (pack_garbage.nr > 0)
                clean_pack_garbage();
 
index 1a298a6711687ccdbd65f088a2bcbc557bef9f10..469b91670782c32d7bc3fb0cb82543ce60d53976 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "repository.h"
 #include "config.h"
 #include "lockfile.h"
 #include "pack.h"
@@ -1777,7 +1778,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
                status = finish_command(&child);
                if (status)
                        return "index-pack abnormal exit";
-               reprepare_packed_git();
+               reprepare_packed_git(the_repository);
        }
        return NULL;
 }
index 3310fd210a151545076169b45f5555b52acbbf9d..eadc2d5172052878c2b9276313cef752baedd839 100644 (file)
@@ -3,6 +3,7 @@
  */
 #include "cache.h"
 #include "bulk-checkin.h"
+#include "repository.h"
 #include "csum-file.h"
 #include "pack.h"
 #include "strbuf.h"
@@ -57,7 +58,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
 
        strbuf_release(&packname);
        /* Make objects we just wrote available to ourselves */
-       reprepare_packed_git();
+       reprepare_packed_git(the_repository);
 }
 
 static int already_written(struct bulk_checkin_state *state, unsigned char sha1[])
index 8253d746e0c40492e05360fe6f27bfa85bb39fbc..eac5928a27bd63f0b27176f3a50af283661c3dfa 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "repository.h"
 #include "config.h"
 #include "lockfile.h"
 #include "refs.h"
@@ -1192,7 +1193,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
        prepare_shallow_info(&si, shallow);
        ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
                                &si, pack_lockfile);
-       reprepare_packed_git();
+       reprepare_packed_git(the_repository);
        update_shallow(args, sought, nr_sought, &si);
        clear_shallow_info(&si);
        return ref_cpy;
index 6b2c86c5e0d1ab158a2f1e4f6fb90e7765d87edf..210fcb3db4c016ff06e26f4e673ba8c87c434433 100644 (file)
@@ -899,7 +899,7 @@ void prepare_packed_git_the_repository(void)
        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;
index 3f59456e7e6bc34c66bb83c1fd2859e297b8ae8a..ab5046938c70f814031d14140b0b6c0da50f70c4 100644 (file)
@@ -36,7 +36,8 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);
 
 #define prepare_packed_git(r) prepare_packed_git_##r()
 extern void prepare_packed_git_the_repository(void);
-extern void reprepare_packed_git(void);
+#define reprepare_packed_git(r) reprepare_packed_git_##r()
+extern void reprepare_packed_git_the_repository(void);
 extern void install_packed_git(struct repository *r, struct packed_git *pack);
 
 struct packed_git *get_packed_git(struct repository *r);
index 0989bbd948dcd025c89c73bbfe72ab7c735e3211..9c024cd957a3aa39635d0bcc67377dffbf2447ad 100644 (file)
@@ -1274,7 +1274,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
                        return 0;
 
                /* Not a loose object; someone else may have just packed it. */
-               reprepare_packed_git();
+               reprepare_packed_git(the_repository);
                if (find_pack_entry(real, &e))
                        break;