]> git.ipfire.org Git - thirdparty/git.git/commit
checkout: rollback lock on early returns in merge_working_tree
authorHarald Nordgren <haraldnordgren@gmail.com>
Tue, 28 Apr 2026 18:39:11 +0000 (18:39 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Apr 2026 12:46:03 +0000 (21:46 +0900)
commit26e4e50d463e1427c6288b33054e5d9a4a99a8f0
tree8c2c19d427f6858bda9a2fcfef880ac02e98b2b5
parente1c8b2d4ece1ada17e818b8c1b0760a47c00cae9
checkout: rollback lock on early returns in merge_working_tree

merge_working_tree() acquires the index lock via
repo_hold_locked_index() but several early return paths exit
without calling rollback_lock_file(), leaving the lock held.
While this is currently harmless because the process exits soon
after, it becomes a problem if the function is ever called more
than once in the same process.

Add rollback_lock_file() calls to all early return paths.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c