Skip to content

Commit 6e7e322

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 c62971c commit 6e7e322

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packfile.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,14 @@ void packfile_store_add_pack(struct packfile_store *store,
792792
hashmap_add(&store->map, &pack->packmap_ent);
793793
}
794794

795+
void packfile_store_add_pack_also_to_mru(struct repository *r,
796+
struct packed_git *pack)
797+
{
798+
packfile_store_add_pack(r->objects->packfiles, pack);
799+
list_add(&pack->mru,
800+
packfile_store_get_packs_mru(r->objects->packfiles));
801+
}
802+
795803
struct packed_git *packfile_store_load_pack(struct packfile_store *store,
796804
const char *idx_path, int local)
797805
{

packfile.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ void packfile_store_reprepare(struct packfile_store *store);
135135
*/
136136
void packfile_store_add_pack(struct packfile_store *store,
137137
struct packed_git *pack);
138+
/*
139+
* Add the pack to the store so that contained objects become accessible via
140+
* the store, and then mark it as most recently used. This moves ownership into
141+
* the store.
142+
*/
143+
void packfile_store_add_pack_also_to_mru(struct repository *r,
144+
struct packed_git *pack);
138145

139146
/*
140147
* Load and iterate through all packs of the given repository. This helper

0 commit comments

Comments
 (0)