Skip to content

Commit 6029459

Browse files
mhaggergitster
authored andcommitted
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 <[email protected]> Reviewed-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f04c5b5 commit 6029459

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

refs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3702,6 +3702,8 @@ int ref_transaction_delete(struct ref_transaction *transaction,
37023702
unsigned int flags, const char *msg,
37033703
struct strbuf *err)
37043704
{
3705+
if (old_sha1 && is_null_sha1(old_sha1))
3706+
die("BUG: delete called with old_sha1 set to zeros");
37053707
return ref_transaction_update(transaction, refname,
37063708
null_sha1, old_sha1,
37073709
flags, msg, err);

0 commit comments

Comments
 (0)