Our is_pseudoref_syntax() function allows upper-case letters, underscore ("_") and dash ("-"). Our glossary definition is vague on the allowed punctuation, but I don't think we have ever used a pseudoref with anything but an underscore. And the existing open-coded syntax check in refname_is_safe() allows only underscores. The logic comes from 266b18273a (refs: add ref_type function, 2015-07-31), but I couldn't find any comment on the dash in the commit message or the list discussion. It's used mostly for is_pseudoref(), which further requires that the name either end in "_HEAD" or be one of a specific set of "irregular" pseudorefs. So I don't think we'd ever see a dash in the real world (you'd need to have "FOO-BAR_HEAD"). Let's tighten this up now so that the function is consistent with (and can be used in) other spots. Signed-off-by: Jeff King <peff@xxxxxxxx> --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index d3d21ecd43..b202dca904 100644 --- a/refs.c +++ b/refs.c @@ -169,7 +169,7 @@ static int is_pseudoref_syntax(const char *refname) const char *c; for (c = refname; *c; c++) { - if (!isupper(*c) && *c != '-' && *c != '_') + if (!isupper(*c) && *c != '_') return 0; } -- 2.45.0.rc1.416.gbe2a76c799