Skip to content

Commit

Permalink
refs.c: ref_transaction_commit should not free the transaction
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ronnie Sahlberg authored and Junio C Hamano committed Jul 14, 2014
1 parent 026bd1d commit 33f9fc5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions builtin/update-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3509,7 +3509,6 @@ int ref_transaction_commit(struct ref_transaction *transaction,
if (updates[i]->lock)
unlock_ref(updates[i]->lock);
free(delnames);
ref_transaction_free(transaction);
return ret;
}

Expand Down
5 changes: 2 additions & 3 deletions refs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 33f9fc5

Please sign in to comment.