]> git.ipfire.org Git - thirdparty/git.git/commit
files-backend: extract out `create_symref_lock()`
authorKarthik Nayak <karthik.188@gmail.com>
Tue, 7 May 2024 12:58:53 +0000 (14:58 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 May 2024 15:51:49 +0000 (08:51 -0700)
commit57d0b1e2ea7d133c0ff2461e99c2847fe4ae55e2
tree0e95040b551d34e543aaa7da9ace43322424f21c
parent1bc4cc3fc4276203e62de610a712c8ddea45b5cf
files-backend: extract out `create_symref_lock()`

The function `create_symref_locked()` creates a symref by creating a
'<symref>.lock' file and then committing the symref lock, which creates
the final symref.

Extract the early half of `create_symref_locked()` into a new helper
function `create_symref_lock()`. Because the name of the new function is
too similar to the original, rename the original to
`create_and_commit_symref()` to avoid confusion.

The new function `create_symref_locked()` can be used to create the
symref lock in a separate step from that of committing it. This allows
to add transactional support for symrefs, where the lock would be
created in the preparation step and the lock would be committed in the
finish step.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c