packfile: add repository argument to reprepare_packed_git
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>
Stefan Beller committed
Mar 23, 2018 at 18:45 UTC
a49d2834359a3fa943edf81e2d146fc787bc1cfe
7 files changed
+11
-7
builtin/gc.c
+1
-1
@@ -478,7 +478,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
478
return error(FAILED_RUN, rerere.argv[0]);
479
480
report_garbage = report_pack_garbage;
481
- reprepare_packed_git();
481
+ reprepare_packed_git(the_repository);
482
if (pack_garbage.nr > 0)
483
clean_pack_garbage();
484
builtin/receive-pack.c
+2
-1
@@ -1,4 +1,5 @@
1
#include "builtin.h"
2
+#include "repository.h"
3
#include "config.h"
4
#include "lockfile.h"
5
#include "pack.h"
@@ -1777,7 +1778,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
1778
status = finish_command(&child);
1779
if (status)
1780
return "index-pack abnormal exit";
1780
- reprepare_packed_git();
1781
+ reprepare_packed_git(the_repository);
1782
}
1783
return NULL;
1784
}
bulk-checkin.c
+2
-1
@@ -3,6 +3,7 @@
3
*/
4
#include "cache.h"
5
#include "bulk-checkin.h"
6
+#include "repository.h"
7
#include "csum-file.h"
8
#include "pack.h"
9
#include "strbuf.h"
@@ -57,7 +58,7 @@ clear_exit:
58
59
strbuf_release(&packname);
60
/* Make objects we just wrote available to ourselves */
60
- reprepare_packed_git();
61
+ reprepare_packed_git(the_repository);
62
}
63
64
static int already_written(struct bulk_checkin_state *state, unsigned char sha1[])
fetch-pack.c
+2
-1
@@ -1,4 +1,5 @@
1
#include "cache.h"
2
+#include "repository.h"
3
#include "config.h"
4
#include "lockfile.h"
5
#include "refs.h"
@@ -1192,7 +1193,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
1193
prepare_shallow_info(&si, shallow);
1194
ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
1195
&si, pack_lockfile);
1195
- reprepare_packed_git();
1196
+ reprepare_packed_git(the_repository);
1197
update_shallow(args, sought, nr_sought, &si);
1198
clear_shallow_info(&si);
1199
return ref_cpy;
packfile.c
+1
-1
@@ -899,7 +899,7 @@ void prepare_packed_git_the_repository(void)
899
the_repository->objects->packed_git_initialized = 1;
900
}
901
902
-void reprepare_packed_git(void)
902
+void reprepare_packed_git_the_repository(void)
903
{
904
the_repository->objects->approximate_object_count_valid = 0;
905
the_repository->objects->packed_git_initialized = 0;
packfile.h
+2
-1
@@ -36,7 +36,8 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);
36
37
#define prepare_packed_git(r) prepare_packed_git_##r()
38
extern void prepare_packed_git_the_repository(void);
39
-extern void reprepare_packed_git(void);
39
+#define reprepare_packed_git(r) reprepare_packed_git_##r()
40
+extern void reprepare_packed_git_the_repository(void);
41
extern void install_packed_git(struct repository *r, struct packed_git *pack);
42
43
struct packed_git *get_packed_git(struct repository *r);
sha1_file.c
+1
-1
@@ -1274,7 +1274,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
1274
return 0;
1275
1276
/* Not a loose object; someone else may have just packed it. */
1277
- reprepare_packed_git();
1277
+ reprepare_packed_git(the_repository);
1278
if (find_pack_entry(real, &e))
1279
break;
1280