summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-04-27 13:54:45 (GMT)
committerMichael Haggerty <mhagger@alum.mit.edu>2016-06-13 09:23:50 (GMT)
commit8a679de6f1a4bd077f828273f75eea46947b5b73 (patch)
tree6118cd062c55624af049c0acef390a6bd62ad16d /refs.c
parent8415d24746b97a479fe5aec9845bfc150cda2d14 (diff)
downloadgit-8a679de6f1a4bd077f828273f75eea46947b5b73.zip
git-8a679de6f1a4bd077f828273f75eea46947b5b73.tar.gz
git-8a679de6f1a4bd077f828273f75eea46947b5b73.tar.bz2
ref_transaction_update(): check refname_is_safe() at a minimum
If the user has asked that a new value be set for a reference, we use check_refname_format() to verify that the reference name satisfies all of the rules. But in other cases, at least check that refname_is_safe(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index 7c4eeb1..842c5c7 100644
--- a/refs.c
+++ b/refs.c
@@ -805,8 +805,9 @@ int ref_transaction_update(struct ref_transaction *transaction,
{
assert(err);
- if (new_sha1 && !is_null_sha1(new_sha1) &&
- check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) {
+ if ((new_sha1 && !is_null_sha1(new_sha1)) ?
+ 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;