Skip to content
Open
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
5 changes: 3 additions & 2 deletions packfile-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,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 skip_dup_check)
{
struct packfile_list_entry *entry;

entry = packfile_list_remove_internal(list, pack);
entry = skip_dup_check ? NULL : packfile_list_remove_internal(list, pack);
if (!entry) {
entry = xmalloc(sizeof(*entry));
entry->pack = pack;
Expand Down
3 changes: 2 additions & 1 deletion packfile-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ 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 skip_dup_check);

/*
* Find the pack within the "packs" list whose index contains the object
Expand Down
2 changes: 1 addition & 1 deletion packfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ void packfile_store_add_pack(struct odb_source_packed *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
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