]> git.ipfire.org Git - thirdparty/git.git/commit
files_initial_transaction_commit(): only unlock if locked
authorMathias Rav <m@git.strova.dk>
Thu, 18 Jan 2018 13:38:41 +0000 (14:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jan 2018 22:16:56 +0000 (14:16 -0800)
commit81fcb698e03543d35c93ec6726a830aa6b9c5167
tree6292b6776de116409c66e7902a21dcd0ec67076c
parent3013dff8662eae06457fe6e5348dfe2270810ab2
files_initial_transaction_commit(): only unlock if locked

Running git clone --single-branch --mirror -b TAGNAME previously
triggered the following error message:

fatal: multiple updates for ref 'refs/tags/TAGNAME' not allowed.

This error condition is handled in files_initial_transaction_commit().

42c7f7ff9 ("commit_packed_refs(): remove call to `packed_refs_unlock()`", 2017-06-23)
introduced incorrect unlocking in the error path of this function,
which changes the error message to

fatal: BUG: packed_refs_unlock() called when not locked

Move the call to packed_refs_unlock() above the "cleanup:" label
since the unlocking should only be done in the last error path.

Signed-off-by: Mathias Rav <m@git.strova.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c