Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2021-12-07 16:38:18 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-08 00:15:19 +0300
commit3c966c7b4e97a5399662f85ab73af08a6419a303 (patch)
treeec71406c8d372ae48eae9be1c109be9546afa7ab /refs.c
parente9706a188f8598ea4d8afac1f70360abb77d4d8d (diff)
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 996ac27164..93bfe5b30c 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;