ref_transaction_create(): disallow recursive pruning
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index ba14105959591d5a46465ad2d56a5346deb4ff74..5dc2473fbb6491c496a1a0b3ac43dfcf90a0000f 100644 (file)
--- a/refs.c
+++ b/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'",