]> git.ipfire.org Git - thirdparty/git.git/commit
refs: atomically record overwritten ref in update_symref
authorBence Ferdinandy <bence@ferdinandy.com>
Fri, 22 Nov 2024 12:28:45 +0000 (13:28 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Nov 2024 02:46:35 +0000 (11:46 +0900)
commitd842cd130122c6f3d3019d467040570d7d001f7a
tree89e96dc4ee82cbcf252d10b23eaddd77c9b9f9cc
parent8102d10ff8317c1e0ba5afb3a41b6a2bc523ff97
refs: atomically record overwritten ref in update_symref

When updating a symref with update_symref it's currently not possible to
know for sure what was the previous value that was overwritten. Extend
refs_update_symref under a new function name, to record the value after
the ref has been locked if the caller of refs_update_symref_extended
requests it via a new variable in the function call. Make the return
value of the function notify the caller, if the previous value was
actually not a symbolic reference. Keep the original refs_update_symref
function with the same signature, but now as a wrapper around
refs_update_symref_extended.

Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h