When deleting refs during a transaction, update the list of the refs to be deleted already during _update instead of waiting until the _commit stage. Signed-off-by: Ronnie Sahlberg <sahlberg@xxxxxxxxxx> --- refs.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/refs.c b/refs.c index cc31efe..3249576 100644 --- a/refs.c +++ b/refs.c @@ -3431,6 +3431,13 @@ int transaction_update_sha1(struct ref_transaction *transaction, hashcpy(update->old_sha1, old_sha1); if (msg) update->msg = xstrdup(msg); + + /* This is a deletion of a ref that exists as a packed ref which means + * we do not need to check against this ref for name collissions + * during locking. + */ + if (update->flags & REF_ISPACKONLY) + add_delname(transaction, update->refname); return 0; } @@ -3550,15 +3557,6 @@ int transaction_commit(struct ref_transaction *transaction, if (ret) goto cleanup; - for (i = 0; i < n; i++) { - struct ref_update *update = updates[i]; - - if (update->update_type != UPDATE_SHA1) - continue; - if (update->flags & REF_ISPACKONLY) - add_delname(transaction, update->refname); - } - /* Acquire all ref locks while verifying old values */ for (i = 0; i < n; i++) { struct ref_update *update = updates[i]; -- 2.0.0.rc3.506.g3739a35 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html