mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
ref_transaction_create(): check that new_sha1 is valid
Creating a reference requires a new_sha1 that is not NULL and not null_sha1. 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:
parent
a933c23e66
commit
f04c5b5522
2
refs.c
2
refs.c
|
@ -3690,6 +3690,8 @@ int ref_transaction_create(struct ref_transaction *transaction,
|
||||||
unsigned int flags, const char *msg,
|
unsigned int flags, const char *msg,
|
||||||
struct strbuf *err)
|
struct strbuf *err)
|
||||||
{
|
{
|
||||||
|
if (!new_sha1 || is_null_sha1(new_sha1))
|
||||||
|
die("BUG: create called without valid new_sha1");
|
||||||
return ref_transaction_update(transaction, refname, new_sha1,
|
return ref_transaction_update(transaction, refname, new_sha1,
|
||||||
null_sha1, flags, msg, err);
|
null_sha1, flags, msg, err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue