Skip to content

Commit 6fdb4e9

Browse files
stefanbellergitster
authored andcommitted
packfile: add repository argument to prepare_packed_git
Add a repository argument to allow prepare_packed_git callers to be more specific about which repository to handle. See commit "sha1_file: add repository argument to link_alt_odb_entry" for an explanation of the #define trick. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 072a109 commit 6fdb4e9

File tree

12 files changed

+18
-17
lines changed

12 files changed

+18
-17
lines changed

builtin/count-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
123123
struct strbuf pack_buf = STRBUF_INIT;
124124
struct strbuf garbage_buf = STRBUF_INIT;
125125
if (!get_packed_git(the_repository))
126-
prepare_packed_git();
126+
prepare_packed_git(the_repository);
127127
for (p = get_packed_git(the_repository); p; p = p->next) {
128128
if (!p->pack_local)
129129
continue;

builtin/fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
729729
uint32_t total = 0, count = 0;
730730
struct progress *progress = NULL;
731731

732-
prepare_packed_git();
732+
prepare_packed_git(the_repository);
733733

734734
if (show_progress) {
735735
for (p = get_packed_git(the_repository); p;

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static int too_many_packs(void)
174174
if (gc_auto_pack_limit <= 0)
175175
return 0;
176176

177-
prepare_packed_git();
177+
prepare_packed_git(the_repository);
178178
for (cnt = 0, p = get_packed_git(the_repository); p; p = p->next) {
179179
if (!p->pack_local)
180180
continue;

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3152,7 +3152,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
31523152
if (progress && all_progress_implied)
31533153
progress = 2;
31543154

3155-
prepare_packed_git();
3155+
prepare_packed_git(the_repository);
31563156
if (ignore_packed_keep) {
31573157
struct packed_git *p;
31583158
for (p = get_packed_git(the_repository); p; p = p->next)

builtin/pack-redundant.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
631631
break;
632632
}
633633

634-
prepare_packed_git();
634+
prepare_packed_git(the_repository);
635635

636636
if (load_all_packs)
637637
load_all();

fast-import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3473,7 +3473,7 @@ int cmd_main(int argc, const char **argv)
34733473
rc_free[i].next = &rc_free[i + 1];
34743474
rc_free[cmd_save - 1].next = NULL;
34753475

3476-
prepare_packed_git();
3476+
prepare_packed_git(the_repository);
34773477
start_packfile();
34783478
set_die_routine(die_nicely);
34793479
set_checkpoint_signal();

http-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ static void get_info_packs(struct strbuf *hdr, char *arg)
519519
size_t cnt = 0;
520520

521521
select_getanyfile(hdr);
522-
prepare_packed_git();
522+
prepare_packed_git(the_repository);
523523
for (p = get_packed_git(the_repository); p; p = p->next) {
524524
if (p->pack_local)
525525
cnt++;

pack-bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static int open_pack_bitmap(void)
336336

337337
assert(!bitmap_git.map && !bitmap_git.loaded);
338338

339-
prepare_packed_git();
339+
prepare_packed_git(the_repository);
340340
for (p = get_packed_git(the_repository); p; p = p->next) {
341341
if (open_pack_bitmap_1(p) == 0)
342342
ret = 0;

packfile.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ unsigned long approximate_object_count(void)
817817
unsigned long count;
818818
struct packed_git *p;
819819

820-
prepare_packed_git();
820+
prepare_packed_git(the_repository);
821821
count = 0;
822822
for (p = the_repository->objects->packed_git; p; p = p->next) {
823823
if (open_pack_index(p))
@@ -884,7 +884,7 @@ static void prepare_packed_git_mru(struct repository *r)
884884
list_add_tail(&p->mru, &r->objects->packed_git_mru);
885885
}
886886

887-
void prepare_packed_git(void)
887+
void prepare_packed_git_the_repository(void)
888888
{
889889
struct alternate_object_database *alt;
890890

@@ -903,7 +903,7 @@ void reprepare_packed_git(void)
903903
{
904904
the_repository->objects->approximate_object_count_valid = 0;
905905
the_repository->objects->packed_git_initialized = 0;
906-
prepare_packed_git();
906+
prepare_packed_git(the_repository);
907907
}
908908

909909
struct packed_git *get_packed_git(struct repository *r)
@@ -1854,7 +1854,7 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
18541854
{
18551855
struct list_head *pos;
18561856

1857-
prepare_packed_git();
1857+
prepare_packed_git(the_repository);
18581858
if (!the_repository->objects->packed_git)
18591859
return 0;
18601860

@@ -1908,7 +1908,7 @@ int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)
19081908
int r = 0;
19091909
int pack_errors = 0;
19101910

1911-
prepare_packed_git();
1911+
prepare_packed_git(the_repository);
19121912
for (p = the_repository->objects->packed_git; p; p = p->next) {
19131913
if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
19141914
continue;

packfile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_
3434
#define PACKDIR_FILE_GARBAGE 4
3535
extern void (*report_garbage)(unsigned seen_bits, const char *path);
3636

37-
extern void prepare_packed_git(void);
37+
#define prepare_packed_git(r) prepare_packed_git_##r()
38+
extern void prepare_packed_git_the_repository(void);
3839
extern void reprepare_packed_git(void);
3940
extern void install_packed_git(struct repository *r, struct packed_git *pack);
4041

server-info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static void init_pack_info(const char *infofile, int force)
201201
objdir = get_object_directory();
202202
objdirlen = strlen(objdir);
203203

204-
prepare_packed_git();
204+
prepare_packed_git(the_repository);
205205
for (p = get_packed_git(the_repository); p; p = p->next) {
206206
/* we ignore things on alternate path since they are
207207
* not available to the pullers in general.

sha1_name.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static void find_short_packed_object(struct disambiguate_state *ds)
196196
{
197197
struct packed_git *p;
198198

199-
prepare_packed_git();
199+
prepare_packed_git(the_repository);
200200
for (p = get_packed_git(the_repository); p && !ds->ambiguous;
201201
p = p->next)
202202
unique_in_pack(p, ds);
@@ -567,7 +567,7 @@ static void find_abbrev_len_packed(struct min_abbrev_data *mad)
567567
{
568568
struct packed_git *p;
569569

570-
prepare_packed_git();
570+
prepare_packed_git(the_repository);
571571
for (p = get_packed_git(the_repository); p; p = p->next)
572572
find_abbrev_len_for_pack(p, mad);
573573
}

0 commit comments

Comments
 (0)