refs.c: make ref_transaction_delete a wrapper for ref_transaction_update

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ronnie Sahlberg committed Dec 5, 2014 at 00:08 UTC a785d3f77c9922846f25d09fb04af9a3400ffbd1
2 files changed +3 -21
refs.c
+2 -20
@@ -3633,26 +3633,8 @@ int ref_transaction_delete(struct ref_transaction *transaction,
3633 int flags, int have_old, const char *msg,
3634 struct strbuf *err)
3635 {
3636 - struct ref_update *update;
3637 -
3638 - assert(err);
3639 -
3640 - if (transaction->state != REF_TRANSACTION_OPEN)
3641 - die("BUG: delete called for transaction that is not open");
3642 -
3643 - if (have_old && !old_sha1)
3644 - die("BUG: have_old is true but old_sha1 is NULL");
3645 -
3646 - update = add_update(transaction, refname);
3647 - update->flags = flags;
3648 - update->have_old = have_old;
3649 - if (have_old) {
3650 - assert(!is_null_sha1(old_sha1));
3651 - hashcpy(update->old_sha1, old_sha1);
3652 - }
3653 - if (msg)
3654 - update->msg = xstrdup(msg);
3655 - return 0;
3636 + return ref_transaction_update(transaction, refname, null_sha1,
3637 + old_sha1, flags, have_old, msg, err);
3638 }
3639
3640 int update_ref(const char *action, const char *refname,
refs.h
+1 -1
@@ -283,7 +283,7 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err);
283
284 /*
285 * Add a reference update to transaction. new_sha1 is the value that
286 - * the reference should have after the update, or zeros if it should
286 + * the reference should have after the update, or null_sha1 if it should
287 * be deleted. If have_old is true, then old_sha1 holds the value
288 * that the reference should have had before the update, or zeros if
289 * it must not have existed beforehand.