git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC 0/7] Make check_refname_format() more flexible

From
mhagger@alum.mit.edu <mhagger@alum.mit.edu>
Date
Apr 30, 2012, 23:02 UTC
Message-ID
<1335826975-3093-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <mhagger@alum.mit.edu>

Here are some patches that I have had kicking around for a while to make check_refname_format() more flexible. In particular, they add a REFNAME_FULL option (for checking that the reference name is a valid full reference name (i.e., either starts with "refs/" or is ALL_CAPS) and a REFNAME_RELAXED option (which relaxes the rules to the level that they only prevent "dangerous" refnames, not just confusing ones).

REFNAME_RELAXED is the name I chose instead of REFNAME_NONSTRICT as discussed on the mailing list. (I decided that "REFNAME_NONSTRICT" looks too much like "REFNAME_STRICT" when reading quickly over it, plus it avoids double negatives.)

Patch 2 fixes a big with the handling of the REFNAME_DOT_COMPONENT option. (I believe that this option is anyway obsoleted by the changes that removed extra_refs; I'll double-check.)

The patches also do some refactoring, like extracting a new function parse_refname_prefix(). If some of these fixes will be needed on older branches, then they should be redone without the refactorings.

Ideally all of the options to check_refname_format() should be covered by tests; on the other hand I don't think it is a good idea to cruft up the interface to "git check-ref-format" with options that are probably not useful outside of the test suite. Is there a precedent for how to add tests for such code?

Michael Haggerty (7):
  check_refname_component(): iterate via index rather than via pointer
  check_refname_component(): fix check with REFNAME_DOT_COMPONENT
  parse_refname_component(): accept a length parameter
  parse_refname_component(): parse until terminator
  parse_refname_prefix(): new function
  check_refname_format(): add REFNAME_FULL option
  check_refname_format(): implement REFNAME_RELAXED option
 Documentation/git-check-ref-format.txt |   14 ++++
 builtin/check-ref-format.c             |    4 +
 refs.c                                 |  136 +++++++++++++++++++++++---------
 refs.h                                 |   16 +++-
 t/t1402-check-ref-format.sh            |   31 ++++++++
 5 files changed, 158 insertions(+), 43 deletions(-)
-- 
1.7.10
Next: mhagger@alum.mit.edu
Message 1 of 8 in “[RFC 0/7] Make check_refname_format() more flexible”
  1. mhagger@alum.mit.eduApr 30, 2012
  2. 1/7 check_refname_component(): iterate via index rather than via pointermhagger@alum.mit.edu, Apr 30, 2012
  3. 2/7 check_refname_component(): fix check with REFNAME_DOT_COMPONENTmhagger@alum.mit.edu, Apr 30, 2012
  4. 3/7 parse_refname_component(): accept a length parametermhagger@alum.mit.edu, Apr 30, 2012
  5. 4/7 parse_refname_component(): parse until terminatormhagger@alum.mit.edu, Apr 30, 2012
  6. 5/7 parse_refname_prefix(): new functionmhagger@alum.mit.edu, Apr 30, 2012
  7. 6/7 check_refname_format(): add REFNAME_FULL optionmhagger@alum.mit.edu, Apr 30, 2012
  8. 7/7 check_refname_format(): implement REFNAME_RELAXED optionmhagger@alum.mit.edu, Apr 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.