Skip to content

Commit

Permalink
ref_transaction_delete(): check that old_sha1 is not null_sha1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Feb 17, 2015
1 parent f04c5b5 commit 6029459
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6029459

Please sign in to comment.