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 <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Feb 17, 2015 at 18:00 UTC
60294596ba6bf2f63506ffad60b9a94fc04612a1
1 file changed
+2
refs.c
+2
@@ -3702,6 +3702,8 @@ int ref_transaction_delete(struct ref_transaction *transaction,
3702
unsigned int flags, const char *msg,
3703
struct strbuf *err)
3704
{
3705
+ if (old_sha1 && is_null_sha1(old_sha1))
3706
+ die("BUG: delete called with old_sha1 set to zeros");
3707
return ref_transaction_update(transaction, refname,
3708
null_sha1, old_sha1,
3709
flags, msg, err);