packfile: add install_packed_git_and_mru()

Create a function to install a new packfile into the packed-git
list and add it to the head of the MRU list.

This function will be used in a later commit to install packfiles
created by dynamic object fetching.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
Jeff Hostetler 2019-09-25 13:36:54 -04:00 коммит произвёл Victoria Dye
Родитель 53a7bd0f50
Коммит b0e9d1a319
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -770,6 +770,12 @@ void install_packed_git(struct repository *r, struct packed_git *pack)
hashmap_add(&r->objects->pack_map, &pack->packmap_ent);
}
void install_packed_git_and_mru(struct repository *r, struct packed_git *pack)
{
install_packed_git(r, pack);
list_add(&pack->mru, &r->objects->packed_git_mru);
}
void (*report_garbage)(unsigned seen_bits, const char *path);
static void report_helper(const struct string_list *list,

Просмотреть файл

@ -67,6 +67,7 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);
void reprepare_packed_git(struct repository *r);
void install_packed_git(struct repository *r, struct packed_git *pack);
void install_packed_git_and_mru(struct repository *r, struct packed_git *pack);
struct packed_git *get_packed_git(struct repository *r);
struct list_head *get_packed_git_mru(struct repository *r);