]> git.ipfire.org Git - thirdparty/git.git/commit
refs/files: batch refname availability checks for initial transactions
authorPatrick Steinhardt <ps@pks.im>
Wed, 12 Mar 2025 15:56:13 +0000 (16:56 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Mar 2025 18:31:18 +0000 (11:31 -0700)
commit268ea8515cd11bd0f3f8c4d64373121058c3fac2
tree9a5f9d104d01e89e7bb3eca3e41e404f5f4ad053
parent6c90726bebfd8ec4dd429f1fad9d00112b1b6603
refs/files: batch refname availability checks for initial transactions

The "files" backend explicitly carves out special logic for its initial
transaction so that it can avoid writing out every single reference as
a loose reference. While the assumption is that there shouldn't be any
preexisting references, we still have to verify that none of the newly
written references will conflict with any other new reference in the
same transaction.

Refactor the initial transaction to use batched refname availability
checks. This does not yet have an effect on performance as we still call
`refs_verify_refname_available()` in a loop. But this will change in
subsequent commits and then impact performance when cloning a repository
with many references or when migrating references to the "files" format.

This will improve performance when cloning a repository with many
references or when migrating references from any format to the "files"
format once the availability checks have learned to optimize checks for
many references in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c