Skip to content

Commit 3a1ec60

Browse files
committed
Merge branch 'sb/packfiles-in-repository'
Refactoring of the internal global data structure continues. * sb/packfiles-in-repository: packfile: keep prepare_packed_git() private packfile: allow find_pack_entry to handle arbitrary repositories packfile: add repository argument to find_pack_entry packfile: allow reprepare_packed_git to handle arbitrary repositories packfile: allow prepare_packed_git to handle arbitrary repositories packfile: allow prepare_packed_git_one to handle arbitrary repositories packfile: add repository argument to reprepare_packed_git packfile: add repository argument to prepare_packed_git packfile: add repository argument to prepare_packed_git_one packfile: allow install_packed_git to handle arbitrary repositories packfile: allow rearrange_packed_git to handle arbitrary repositories packfile: allow prepare_packed_git_mru to handle arbitrary repositories
2 parents cf0b179 + 464416a commit 3a1ec60

17 files changed

+58
-67
lines changed

builtin/count-objects.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
122122
struct strbuf loose_buf = STRBUF_INIT;
123123
struct strbuf pack_buf = STRBUF_INIT;
124124
struct strbuf garbage_buf = STRBUF_INIT;
125-
if (!get_packed_git(the_repository))
126-
prepare_packed_git();
125+
127126
for (p = get_packed_git(the_repository); p; p = p->next) {
128127
if (!p->pack_local)
129128
continue;

builtin/fsck.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,6 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
735735
uint32_t total = 0, count = 0;
736736
struct progress *progress = NULL;
737737

738-
prepare_packed_git();
739-
740738
if (show_progress) {
741739
for (p = get_packed_git(the_repository); p;
742740
p = p->next) {

builtin/gc.c

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

177-
prepare_packed_git();
178177
for (cnt = 0, p = get_packed_git(the_repository); p; p = p->next) {
179178
if (!p->pack_local)
180179
continue;
@@ -481,7 +480,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
481480
return error(FAILED_RUN, rerere.argv[0]);
482481

483482
report_garbage = report_pack_garbage;
484-
reprepare_packed_git();
483+
reprepare_packed_git(the_repository);
485484
if (pack_garbage.nr > 0)
486485
clean_pack_garbage();
487486

builtin/pack-objects.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
31483148
if (progress && all_progress_implied)
31493149
progress = 2;
31503150

3151-
prepare_packed_git();
31523151
if (ignore_packed_keep) {
31533152
struct packed_git *p;
31543153
for (p = get_packed_git(the_repository); p; p = p->next)

builtin/pack-redundant.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,6 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
631631
break;
632632
}
633633

634-
prepare_packed_git();
635-
636634
if (load_all_packs)
637635
load_all();
638636
else

builtin/receive-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "builtin.h"
2+
#include "repository.h"
23
#include "config.h"
34
#include "lockfile.h"
45
#include "pack.h"
@@ -1778,7 +1779,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
17781779
status = finish_command(&child);
17791780
if (status)
17801781
return "index-pack abnormal exit";
1781-
reprepare_packed_git();
1782+
reprepare_packed_git(the_repository);
17821783
}
17831784
return NULL;
17841785
}

bulk-checkin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44
#include "cache.h"
55
#include "bulk-checkin.h"
6+
#include "repository.h"
67
#include "csum-file.h"
78
#include "pack.h"
89
#include "strbuf.h"
@@ -57,7 +58,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
5758

5859
strbuf_release(&packname);
5960
/* Make objects we just wrote available to ourselves */
60-
reprepare_packed_git();
61+
reprepare_packed_git(the_repository);
6162
}
6263

6364
static int already_written(struct bulk_checkin_state *state, struct object_id *oid)

fast-import.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ static void end_packfile(void)
10381038
if (!new_p)
10391039
die("core git rejected index %s", idx_name);
10401040
all_packs[pack_id] = new_p;
1041-
install_packed_git(new_p);
1041+
install_packed_git(the_repository, new_p);
10421042
free(idx_name);
10431043

10441044
/* Print the boundary */
@@ -3476,7 +3476,6 @@ int cmd_main(int argc, const char **argv)
34763476
rc_free[i].next = &rc_free[i + 1];
34773477
rc_free[cmd_save - 1].next = NULL;
34783478

3479-
prepare_packed_git();
34803479
start_packfile();
34813480
set_die_routine(die_nicely);
34823481
set_checkpoint_signal();

fetch-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "cache.h"
2+
#include "repository.h"
23
#include "config.h"
34
#include "lockfile.h"
45
#include "refs.h"
@@ -1240,7 +1241,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
12401241
prepare_shallow_info(&si, shallow);
12411242
ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
12421243
&si, pack_lockfile);
1243-
reprepare_packed_git();
1244+
reprepare_packed_git(the_repository);
12441245
update_shallow(args, sought, nr_sought, &si);
12451246
clear_shallow_info(&si);
12461247
return ref_cpy;

http-backend.c

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

521521
select_getanyfile(hdr);
522-
prepare_packed_git();
523522
for (p = get_packed_git(the_repository); p; p = p->next) {
524523
if (p->pack_local)
525524
cnt++;

0 commit comments

Comments
 (0)