Skip to content

Commit

Permalink
packfile: add install_packed_git_and_mru()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jeffhostetler authored and dscho committed Aug 9, 2023
1 parent 585c905 commit f73d6ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,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,
Expand Down
1 change: 1 addition & 0 deletions packfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f73d6ad

Please sign in to comment.