MCPcopy Index your code
hub / github.com/git/git / transaction_refname_valid

Function transaction_refname_valid

refs.c:1360–1388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1358}
1359
1360static int transaction_refname_valid(const char *refname,
1361 const struct object_id *new_oid,
1362 unsigned int flags, struct strbuf *err)
1363{
1364 if (flags & REF_SKIP_REFNAME_VERIFICATION)
1365 return 1;
1366
1367 if (is_pseudo_ref(refname)) {
1368 const char *refusal_msg;
1369 if (flags & REF_LOG_ONLY)
1370 refusal_msg = _("refusing to update reflog for pseudoref '%s'");
1371 else
1372 refusal_msg = _("refusing to update pseudoref '%s'");
1373 strbuf_addf(err, refusal_msg, refname);
1374 return 0;
1375 } else if ((new_oid && !is_null_oid(new_oid)) ?
1376 check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) :
1377 !refname_is_safe(refname)) {
1378 const char *refusal_msg;
1379 if (flags & REF_LOG_ONLY)
1380 refusal_msg = _("refusing to update reflog with bad name '%s'");
1381 else
1382 refusal_msg = _("refusing to update ref with bad name '%s'");
1383 strbuf_addf(err, refusal_msg, refname);
1384 return 0;
1385 }
1386
1387 return 1;
1388}
1389
1390enum ref_transaction_error ref_transaction_update(struct ref_transaction *transaction,
1391 const char *refname,

Callers 2

ref_transaction_updateFunction · 0.85

Calls 5

is_pseudo_refFunction · 0.85
strbuf_addfFunction · 0.85
is_null_oidFunction · 0.85
check_refname_formatFunction · 0.85
refname_is_safeFunction · 0.85

Tested by

no test coverage detected