git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mhagger@alum.mit.edu
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Michael Haggerty <mhagger@alum.mit.edu>
Subject: [RFC 0/7] Make check_refname_format() more flexible
Date: Tue,  1 May 2012 01:02:48 +0200	[thread overview]
Message-ID: <1335826975-3093-1-git-send-email-mhagger@alum.mit.edu> (raw)

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

             reply	other threads:[~2012-04-30 23:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 23:02 mhagger [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1335826975-3093-1-git-send-email-mhagger@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).