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 коммит произвёл Johannes Schindelin
Родитель f35890c5bf
Коммит a4594ab538
2 изменённых файлов: 7 добавлений и 0 удалений

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

@ -762,6 +762,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,

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

@ -53,6 +53,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);