summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2021-12-07 13:38:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-07 21:15:19 (GMT)
commit3c966c7b4e97a5399662f85ab73af08a6419a303 (patch)
treeec71406c8d372ae48eae9be1c109be9546afa7ab /refs.c
parente9706a188f8598ea4d8afac1f70360abb77d4d8d (diff)
downloadgit-3c966c7b4e97a5399662f85ab73af08a6419a303.zip
git-3c966c7b4e97a5399662f85ab73af08a6419a303.tar.gz
git-3c966c7b4e97a5399662f85ab73af08a6419a303.tar.bz2
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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index 996ac27..93bfe5b 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;