From 60294596ba6bf2f63506ffad60b9a94fc04612a1 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Tue, 17 Feb 2015 18:00:20 +0100 Subject: ref_transaction_delete(): check that old_sha1 is not null_sha1 It makes no sense to delete a reference that is already known not to exist. Signed-off-by: Michael Haggerty Reviewed-by: Stefan Beller Signed-off-by: Junio C Hamano --- refs.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'refs.c') diff --git a/refs.c b/refs.c index b9cf284f31..d5bfd11790 100644 --- a/refs.c +++ b/refs.c @@ -3702,6 +3702,8 @@ int ref_transaction_delete(struct ref_transaction *transaction, unsigned int flags, const char *msg, struct strbuf *err) { + if (old_sha1 && is_null_sha1(old_sha1)) + die("BUG: delete called with old_sha1 set to zeros"); return ref_transaction_update(transaction, refname, null_sha1, old_sha1, flags, msg, err); -- cgit v1.2.3