packfile: allow prepare_packed_git to handle arbitrary repositories
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>maint
parent
935cdd6922
commit
0f90a9f27e
18
packfile.c
18
packfile.c
|
@ -883,19 +883,19 @@ static void prepare_packed_git_mru(struct repository *r)
|
||||||
list_add_tail(&p->mru, &r->objects->packed_git_mru);
|
list_add_tail(&p->mru, &r->objects->packed_git_mru);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare_packed_git_the_repository(void)
|
void prepare_packed_git(struct repository *r)
|
||||||
{
|
{
|
||||||
struct alternate_object_database *alt;
|
struct alternate_object_database *alt;
|
||||||
|
|
||||||
if (the_repository->objects->packed_git_initialized)
|
if (r->objects->packed_git_initialized)
|
||||||
return;
|
return;
|
||||||
prepare_packed_git_one(the_repository, get_object_directory(), 1);
|
prepare_packed_git_one(r, r->objects->objectdir, 1);
|
||||||
prepare_alt_odb(the_repository);
|
prepare_alt_odb(r);
|
||||||
for (alt = the_repository->objects->alt_odb_list; alt; alt = alt->next)
|
for (alt = r->objects->alt_odb_list; alt; alt = alt->next)
|
||||||
prepare_packed_git_one(the_repository, alt->path, 0);
|
prepare_packed_git_one(r, alt->path, 0);
|
||||||
rearrange_packed_git(the_repository);
|
rearrange_packed_git(r);
|
||||||
prepare_packed_git_mru(the_repository);
|
prepare_packed_git_mru(r);
|
||||||
the_repository->objects->packed_git_initialized = 1;
|
r->objects->packed_git_initialized = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reprepare_packed_git_the_repository(void)
|
void reprepare_packed_git_the_repository(void)
|
||||||
|
|
|
@ -34,8 +34,7 @@ extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_
|
||||||
#define PACKDIR_FILE_GARBAGE 4
|
#define PACKDIR_FILE_GARBAGE 4
|
||||||
extern void (*report_garbage)(unsigned seen_bits, const char *path);
|
extern void (*report_garbage)(unsigned seen_bits, const char *path);
|
||||||
|
|
||||||
#define prepare_packed_git(r) prepare_packed_git_##r()
|
extern void prepare_packed_git(struct repository *r);
|
||||||
extern void prepare_packed_git_the_repository(void);
|
|
||||||
#define reprepare_packed_git(r) reprepare_packed_git_##r()
|
#define reprepare_packed_git(r) reprepare_packed_git_##r()
|
||||||
extern void reprepare_packed_git_the_repository(void);
|
extern void reprepare_packed_git_the_repository(void);
|
||||||
extern void install_packed_git(struct repository *r, struct packed_git *pack);
|
extern void install_packed_git(struct repository *r, struct packed_git *pack);
|
||||||
|
|
Loading…
Reference in New Issue