]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/stack: use lock_file when adding table to "tables.list"
authorPatrick Steinhardt <ps@pks.im>
Thu, 8 Aug 2024 14:06:49 +0000 (16:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Aug 2024 17:14:43 +0000 (10:14 -0700)
commit128b9aa3e9d3dc0417f8f65a240aad736db97959
treea60bc899bf01b09400097dd603e61e1bf88e9022
parent7ee307da1bfe3867f91fbd9a053494bc5fe61675
reftable/stack: use lock_file when adding table to "tables.list"

When modifying "tables.list", we need to lock the list before updating
it to ensure that no concurrent writers modify the list at the same
point in time. While we do this via the `lock_file` subsystem when
compacting the stack, we manually handle the lock when adding a new
table to it. While not wrong, it is at least inconsistent.

Refactor the code to consistently lock "tables.list" via the `lock_file`
subsytem.

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