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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Haggerty <mhagger@xxxxxxxxxxxx>

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]