Skip to content

Commit 4d8ca07

Browse files
jeffhostetlerdscho
authored andcommitted
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>
1 parent 698c329 commit 4d8ca07

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packfile.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,12 @@ void install_packed_git(struct repository *r, struct packed_git *pack)
781781
hashmap_add(&r->objects->pack_map, &pack->packmap_ent);
782782
}
783783

784+
void install_packed_git_and_mru(struct repository *r, struct packed_git *pack)
785+
{
786+
install_packed_git(r, pack);
787+
list_add(&pack->mru, &r->objects->packed_git_mru);
788+
}
789+
784790
void (*report_garbage)(unsigned seen_bits, const char *path);
785791

786792
static void report_helper(const struct string_list *list,

packfile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);
6868

6969
void reprepare_packed_git(struct repository *r);
7070
void install_packed_git(struct repository *r, struct packed_git *pack);
71+
void install_packed_git_and_mru(struct repository *r, struct packed_git *pack);
7172

7273
struct packed_git *get_packed_git(struct repository *r);
7374
struct list_head *get_packed_git_mru(struct repository *r);

0 commit comments

Comments
 (0)