diff options
author | Han-Wen Nienhuys <hanwen@google.com> | 2021-12-07 13:38:18 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-07 13:15:19 -0800 |
commit | 3c966c7b4e97a5399662f85ab73af08a6419a303 (patch) | |
tree | ec71406c8d372ae48eae9be1c109be9546afa7ab /refs.c | |
parent | e9706a188f8598ea4d8afac1f70360abb77d4d8d (diff) | |
download | git-3c966c7b4e97a5399662f85ab73af08a6419a303.tar.gz |
refs: introduce REF_SKIP_REFNAME_VERIFICATION flag
Use this flag with the test-helper in t1430, to avoid direct writes to the ref
database.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1083,9 +1083,10 @@ int ref_transaction_update(struct ref_transaction *transaction, { assert(err); - if ((new_oid && !is_null_oid(new_oid)) ? - check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) : - !refname_is_safe(refname)) { + if (!(flags & REF_SKIP_REFNAME_VERIFICATION) && + ((new_oid && !is_null_oid(new_oid)) ? + check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) : + !refname_is_safe(refname))) { strbuf_addf(err, _("refusing to update ref with bad name '%s'"), refname); return -1; |