Skip to content

Commit a785d3f

Browse files
rsahlberggitster
authored andcommitted
refs.c: make ref_transaction_delete a wrapper for ref_transaction_update
Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Reviewed-by: Michael Haggerty <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc9f292 commit a785d3f

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

refs.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,26 +3633,8 @@ int ref_transaction_delete(struct ref_transaction *transaction,
36333633
int flags, int have_old, const char *msg,
36343634
struct strbuf *err)
36353635
{
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);
36563638
}
36573639

36583640
int update_ref(const char *action, const char *refname,

refs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err);
283283

284284
/*
285285
* 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
287287
* be deleted. If have_old is true, then old_sha1 holds the value
288288
* that the reference should have had before the update, or zeros if
289289
* it must not have existed beforehand.

0 commit comments

Comments
 (0)