Skip to content

Commit 81fcb69

Browse files
Mortalgitster
authored andcommitted
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(). 42c7f7f ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3013dff commit 81fcb69

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

refs/files-backend.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,13 +2874,12 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
28742874

28752875
if (initial_ref_transaction_commit(packed_transaction, err)) {
28762876
ret = TRANSACTION_GENERIC_ERROR;
2877-
goto cleanup;
28782877
}
28792878

2879+
packed_refs_unlock(refs->packed_ref_store);
28802880
cleanup:
28812881
if (packed_transaction)
28822882
ref_transaction_free(packed_transaction);
2883-
packed_refs_unlock(refs->packed_ref_store);
28842883
transaction->state = REF_TRANSACTION_CLOSED;
28852884
string_list_clear(&affected_refnames, 0);
28862885
return ret;

0 commit comments

Comments
 (0)