]> git.ipfire.org Git - thirdparty/git.git/commit
refs/files: support symbolic and root refs in initial transaction
authorPatrick Steinhardt <ps@pks.im>
Wed, 20 Nov 2024 07:51:33 +0000 (08:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Nov 2024 22:59:15 +0000 (07:59 +0900)
commitc0b9cf3b55e9e1d6ea2d848bae1f8efe67b3b61b
tree503ec038438cf2794935b4a1e7e05c55b4eab251
parent1c299d03e5551847533019aa32863d2cbe589c7f
refs/files: support symbolic and root refs in initial transaction

The "files" backend has implemented special logic when committing
the first transactions in an otherwise empty ref store: instead of
writing all refs as separate loose files, it instead knows to write them
all into a "packed-refs" file directly. This is significantly more
efficient than having to write each of the refs as separate "loose" ref.

The only user of this optimization is git-clone(1), which only uses this
mechanism to write regular refs. Consequently, the implementation does
not know how to handle both symbolic and root refs. While fine in the
context of git-clone(1), this keeps us from using the mechanism in more
cases.

Adapt the logic to also support symbolic and root refs by using a second
transaction that we use for all of the refs that need to be written as
loose refs.

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