Skip to content

Commit 0f90a9f

Browse files
stefanbellergitster
authored andcommitted
packfile: allow prepare_packed_git to handle arbitrary repositories
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 935cdd6 commit 0f90a9f

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

packfile.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -883,19 +883,19 @@ static void prepare_packed_git_mru(struct repository *r)
883883
list_add_tail(&p->mru, &r->objects->packed_git_mru);
884884
}
885885

886-
void prepare_packed_git_the_repository(void)
886+
void prepare_packed_git(struct repository *r)
887887
{
888888
struct alternate_object_database *alt;
889889

890-
if (the_repository->objects->packed_git_initialized)
890+
if (r->objects->packed_git_initialized)
891891
return;
892-
prepare_packed_git_one(the_repository, get_object_directory(), 1);
893-
prepare_alt_odb(the_repository);
894-
for (alt = the_repository->objects->alt_odb_list; alt; alt = alt->next)
895-
prepare_packed_git_one(the_repository, alt->path, 0);
896-
rearrange_packed_git(the_repository);
897-
prepare_packed_git_mru(the_repository);
898-
the_repository->objects->packed_git_initialized = 1;
892+
prepare_packed_git_one(r, r->objects->objectdir, 1);
893+
prepare_alt_odb(r);
894+
for (alt = r->objects->alt_odb_list; alt; alt = alt->next)
895+
prepare_packed_git_one(r, alt->path, 0);
896+
rearrange_packed_git(r);
897+
prepare_packed_git_mru(r);
898+
r->objects->packed_git_initialized = 1;
899899
}
900900

901901
void reprepare_packed_git_the_repository(void)

packfile.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ 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-
#define prepare_packed_git(r) prepare_packed_git_##r()
38-
extern void prepare_packed_git_the_repository(void);
37+
extern void prepare_packed_git(struct repository *r);
3938
#define reprepare_packed_git(r) reprepare_packed_git_##r()
4039
extern void reprepare_packed_git_the_repository(void);
4140
extern void install_packed_git(struct repository *r, struct packed_git *pack);

0 commit comments

Comments
 (0)