1
0
mirror of https://github.com/git/git synced 2024-07-04 16:48:40 +00:00

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>
This commit is contained in:
Michael Haggerty 2015-02-17 18:00:20 +01:00 committed by Junio C Hamano
parent f04c5b5522
commit 60294596ba

2
refs.c
View File

@ -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);