ref_transaction_update(): remove "have_old" parameter

Instead, verify the reference's old value if and only if old_sha1 is
non-NULL.

ref_transaction_delete() will get the same treatment in a moment.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael Haggerty
2015-02-17 18:00:15 +01:00
committed by Junio C Hamano
parent 8df4e51138
commit 1d147bdff0
12 changed files with 31 additions and 29 deletions

View File

@ -198,8 +198,9 @@ static const char *parse_cmd_update(struct ref_transaction *transaction,
if (*next != line_termination)
die("update %s: extra input: %s", refname, next);
if (ref_transaction_update(transaction, refname, new_sha1, old_sha1,
update_flags, have_old, msg, &err))
if (ref_transaction_update(transaction, refname,
new_sha1, have_old ? old_sha1 : NULL,
update_flags, msg, &err))
die("%s", err.buf);
update_flags = 0;
@ -297,7 +298,7 @@ static const char *parse_cmd_verify(struct ref_transaction *transaction,
die("verify %s: extra input: %s", refname, next);
if (ref_transaction_update(transaction, refname, new_sha1, old_sha1,
update_flags, 1, msg, &err))
update_flags, msg, &err))
die("%s", err.buf);
update_flags = 0;