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 <sahlb...@google.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to