aboutsummaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-12-15 09:39:54 -0800
committerJunio C Hamano <gitster@pobox.com>2021-12-15 09:39:54 -0800
commitb174a3c01423897154d26c96baab366229f16976 (patch)
tree95615d66817ffcc6e111cfa95fb591017e474980 /refs.c
parentbc32aa1e63218b0011159af4703e1389354c69f9 (diff)
parent9912391402ad1b910c6d712565553d7e5b22d7e1 (diff)
downloadgit-b174a3c01423897154d26c96baab366229f16976.tar.gz
Merge branch 'hn/allow-bogus-oid-in-ref-tests'
The test helper for refs subsystem learned to write bogus and/or nonexistent object name to refs to simulate error situations we want to test Git in. * hn/allow-bogus-oid-in-ref-tests: t1430: create valid symrefs using test-helper t1430: remove refs using test-tool refs: introduce REF_SKIP_REFNAME_VERIFICATION flag refs: introduce REF_SKIP_OID_VERIFICATION flag refs: update comment. test-ref-store: plug memory leak in cmd_delete_refs test-ref-store: parse symbolic flag constants test-ref-store: remove force-create argument for create-reflog
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index 4338875d86..4c31795581 100644
--- a/refs.c
+++ b/refs.c
@@ -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;