summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorMathias Rav <m@git.strova.dk>2018-01-18 13:38:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-19 22:16:56 (GMT)
commit81fcb698e03543d35c93ec6726a830aa6b9c5167 (patch)
tree6292b6776de116409c66e7902a21dcd0ec67076c /refs
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-81fcb698e03543d35c93ec6726a830aa6b9c5167.zip
git-81fcb698e03543d35c93ec6726a830aa6b9c5167.tar.gz
git-81fcb698e03543d35c93ec6726a830aa6b9c5167.tar.bz2
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>
Diffstat (limited to 'refs')
-rw-r--r--refs/files-backend.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index a80d60a..afe5c4e 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -2874,13 +2874,12 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
if (initial_ref_transaction_commit(packed_transaction, err)) {
ret = TRANSACTION_GENERIC_ERROR;
- goto cleanup;
}
+ packed_refs_unlock(refs->packed_ref_store);
cleanup:
if (packed_transaction)
ref_transaction_free(packed_transaction);
- packed_refs_unlock(refs->packed_ref_store);
transaction->state = REF_TRANSACTION_CLOSED;
string_list_clear(&affected_refnames, 0);
return ret;