]> granicus.if.org Git - git/commitdiff
refs.c: ref_transaction_commit should not free the transaction
authorRonnie Sahlberg <sahlberg@google.com>
Fri, 20 Jun 2014 14:42:43 +0000 (07:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Jul 2014 18:54:40 +0000 (11:54 -0700)
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
builtin/update-ref.c
refs.c
refs.h

index 405267f6e2776b3b2bf5c91c1102e090f5ac68f0..1fd7a8918693fca9610cb8d5de68b8607be4a30a 100644 (file)
@@ -369,6 +369,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
                update_refs_stdin();
                ret = ref_transaction_commit(transaction, msg,
                                             UPDATE_REFS_DIE_ON_ERR);
+               ref_transaction_free(transaction);
                return ret;
        }
 
diff --git a/refs.c b/refs.c
index 6d841a06458f45b5e88950cfca3de02f98ebf4da..d9cac6db18da868a1fedf2e2a5f1a0c1bad2bf20 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -3509,7 +3509,6 @@ cleanup:
                if (updates[i]->lock)
                        unlock_ref(updates[i]->lock);
        free(delnames);
-       ref_transaction_free(transaction);
        return ret;
 }
 
diff --git a/refs.h b/refs.h
index cfd1832f3f9d9e15b7ace0a617a4b24a553a1de8..7d946f6b8ba21fa9f5bda02641a538411eecd0d3 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -219,8 +219,7 @@ enum action_on_err {
 
 /*
  * Begin a reference transaction.  The reference transaction must
- * eventually be commited using ref_transaction_commit() or freed by
- * calling ref_transaction_free().
+ * be freed by calling ref_transaction_free().
  */
 struct ref_transaction *ref_transaction_begin(void);
 
@@ -268,7 +267,7 @@ void ref_transaction_delete(struct ref_transaction *transaction,
 /*
  * Commit all of the changes that have been queued in transaction, as
  * atomically as possible.  Return a nonzero value if there is a
- * problem.  The ref_transaction is freed by this function.
+ * problem.
  */
 int ref_transaction_commit(struct ref_transaction *transaction,
                           const char *msg, enum action_on_err onerr);