ref_transaction_create(): disallow recursive pruning
It is nonsensical (and a little bit dangerous) to use REF_ISPRUNING without REF_NODEREF. Forbid it explicitly. Change the one REF_ISPRUNING caller to pass REF_NODEREF too. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
This commit is contained in:
3
refs.c
3
refs.c
@ -790,6 +790,9 @@ int ref_transaction_update(struct ref_transaction *transaction,
|
||||
if (transaction->state != REF_TRANSACTION_OPEN)
|
||||
die("BUG: update called for transaction that is not open");
|
||||
|
||||
if ((flags & REF_ISPRUNING) && !(flags & REF_NODEREF))
|
||||
die("BUG: REF_ISPRUNING set without REF_NODEREF");
|
||||
|
||||
if (new_sha1 && !is_null_sha1(new_sha1) &&
|
||||
check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) {
|
||||
strbuf_addf(err, "refusing to update ref with bad name '%s'",
|
||||
|
||||
Reference in New Issue
Block a user