Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ void packfile_list_prepend(struct packfile_list *list, struct packed_git *pack)
list->tail = entry;
}

void packfile_list_append(struct packfile_list *list, struct packed_git *pack)
void packfile_list_append(struct packfile_list *list, struct packed_git *pack,
int is_new)
{
struct packfile_list_entry *entry;

entry = packfile_list_remove_internal(list, pack);
entry = is_new ? NULL : packfile_list_remove_internal(list, pack);
if (!entry) {
entry = xmalloc(sizeof(*entry));
entry->pack = pack;
Expand Down Expand Up @@ -865,7 +866,7 @@ void packfile_store_add_pack(struct packfile_store *store,
if (pack->pack_fd != -1)
pack_open_fds++;

packfile_list_append(&store->packs, pack);
packfile_list_append(&store->packs, pack, 1);
strmap_put(&store->packs_by_path, pack->pack_name, pack);
}

Expand Down
2 changes: 1 addition & 1 deletion packfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct packfile_list_entry {
void packfile_list_clear(struct packfile_list *list);
void packfile_list_remove(struct packfile_list *list, struct packed_git *pack);
void packfile_list_prepend(struct packfile_list *list, struct packed_git *pack);
void packfile_list_append(struct packfile_list *list, struct packed_git *pack);
void packfile_list_append(struct packfile_list *list, struct packed_git *pack, int is_new);

/*
* Find the pack within the "packs" list whose index contains the object
Expand Down
4 changes: 4 additions & 0 deletions t/perf/p5303-many-packs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,8 @@ test_perf "load 10,000 packs" '
git rev-parse --verify "HEAD^{commit}"
'

test_perf "abbreviate with 10,000 packs" '
git rev-parse --short HEAD
'

test_done
Loading