From: Ronnie Sahlberg Date: Wed, 14 May 2014 22:13:17 GMT Subject: [PATCH 18/31] refs.c: return immediately from _commit if the transaction has an error Message-ID: <1400105610-21194-19-git-send-email-sahlberg@google.com> In-Reply-To: <1400105610-21194-1-git-send-email-sahlberg@google.com> If a previous transaction operation has failed and flagged a transaction as having an error, then return immediately from commit and indicate failure. Once we move checks from _commit to _update, _update will already have updated the error string so the caller will know what failed. Thus we don't need to do anything at all in _commit than return failure. Signed-off-by: Ronnie Sahlberg --- refs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/refs.c b/refs.c index 8b09258..93f01e8 100644 --- a/refs.c +++ b/refs.c @@ -3558,6 +3558,9 @@ int transaction_commit(struct ref_transaction *transaction, int n = transaction->nr; struct ref_update **updates = transaction->updates; + if (transaction->status == REF_TRANSACTION_ERROR) + return 1; + if (transaction->status != REF_TRANSACTION_OPEN) die("BUG: commit on transaction that is not open"); -- 2.0.0.rc3.506.g3739a35