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 коммит произвёл Junio C Hamano
Родитель f04c5b5522
Коммит 60294596ba
1 изменённых файлов: 2 добавлений и 0 удалений

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