git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/7] Make check_refname_format() more flexible
@ 2012-04-30 23:02 mhagger
  2012-04-30 23:02 ` [RFC 1/7] check_refname_component(): iterate via index rather than via pointer mhagger
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mhagger @ 2012-04-30 23:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jeff King, Michael Haggerty

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-30 23:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-30 23:02 [RFC 0/7] Make check_refname_format() more flexible mhagger
2012-04-30 23:02 ` [RFC 1/7] check_refname_component(): iterate via index rather than via pointer mhagger
2012-04-30 23:02 ` [RFC 2/7] check_refname_component(): fix check with REFNAME_DOT_COMPONENT mhagger
2012-04-30 23:02 ` [RFC 3/7] parse_refname_component(): accept a length parameter mhagger
2012-04-30 23:02 ` [RFC 4/7] parse_refname_component(): parse until terminator mhagger
2012-04-30 23:02 ` [RFC 5/7] parse_refname_prefix(): new function mhagger
2012-04-30 23:02 ` [RFC 6/7] check_refname_format(): add REFNAME_FULL option mhagger
2012-04-30 23:02 ` [RFC 7/7] check_refname_format(): implement REFNAME_RELAXED option mhagger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).