Git development
 help / color / mirror / Atom feed
From: David Turner <dturner@twopensource.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Jacob Keller <jacob.keller@gmail.com>,
	Daniel Barkalow <barkalow@iabervon.iabervon.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3] refs: loosen restrictions on wildcard '*' refspecs
Date: Wed, 22 Jul 2015 14:21:01 -0400	[thread overview]
Message-ID: <1437589261.4520.2.camel@twopensource.com> (raw)
In-Reply-To: <1437581180-26883-1-git-send-email-jacob.e.keller@intel.com>

On Wed, 2015-07-22 at 09:06 -0700, Jacob Keller wrote:
> From: Jacob Keller <jacob.keller@gmail.com>
> 
> Update the check_refname_component logic in order to allow for a less
> strict refspec format in regards to REFNAME_REFSPEC_PATTERN. Previously
> the '*' could only replace a single full component, and could not
> replace arbitrary text. Now, refs such as `foo/bar*:foo/bar*` will be
> accepted. This allows for somewhat more flexibility in references and
> does not break any current users. The ref matching code already allows
> this but the check_refname_format did not. Note this does also allow
> refs such as `foo/bar*:foe/baz*`, that is, arbitrary renames. This was
> already possible with namespace sections before, but now is possible
> even as part of the pattern section. Since users have to explicitly type
> these into the configuration it does not seem an issue.
> 
> Also streamline the code by making this new check part of
> check_refname_component instead of checking after we error during
> check_refname_format, which fits better with how other issues in refname
> components are checked.
> 
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> Cc: Daniel Barkalow <barkalow@iabervon.iabervon.org>
> Cc: Junio C Hamano <gitster@pobox.com>
> ---
> 
> I updated the patch description a bit. This is also re-based onto the
> next/ branch in-case. This is mostly a resend so that anyone interested
> in review has another chance to see the patch.
> 
>  Documentation/git-check-ref-format.txt |  4 ++--
>  refs.c                                 | 39 +++++++++++++++++++---------------
>  refs.h                                 |  4 ++--
>  t/t1402-check-ref-format.sh            |  8 ++++---
>  4 files changed, 31 insertions(+), 24 deletions(-)
> 
> diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt
> index fc02959ba4ab..9044dfaadae1 100644
> --- a/Documentation/git-check-ref-format.txt
> +++ b/Documentation/git-check-ref-format.txt
> @@ -94,8 +94,8 @@ OPTIONS
>  	Interpret <refname> as a reference name pattern for a refspec
>  	(as used with remote repositories).  If this option is
>  	enabled, <refname> is allowed to contain a single `*`
> -	in place of a one full pathname component (e.g.,
> -	`foo/*/bar` but not `foo/bar*`).
> +	in the refspec (e.g., `foo/bar*/baz` or `foo/bar*baz/`
> +	but not `foo/bar*/baz*`).
>  
>  --normalize::
>  	Normalize 'refname' by removing any leading slash (`/`)
> diff --git a/refs.c b/refs.c
> index ce8cd8d45001..3002015ff289 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -20,11 +20,12 @@ struct ref_lock {
>   * 2: ., look for a preceding . to reject .. in refs
>   * 3: {, look for a preceding @ to reject @{ in refs
>   * 4: A bad character: ASCII control characters, "~", "^", ":" or SP
> + * 5: check for patterns to reject unless REFNAME_REFSPEC_PATTERN is set

How about this:
+ 5: *, reject unless REFNAME_REFSPEC_PATTERN is set

(I guess it's possible that we would later allow other pattern chars,
but we could change the message then).

  reply	other threads:[~2015-07-22 18:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 16:06 [PATCH v3] refs: loosen restrictions on wildcard '*' refspecs Jacob Keller
2015-07-22 18:21 ` David Turner [this message]
2015-07-22 18:24   ` Jacob Keller

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=1437589261.4520.2.camel@twopensource.com \
    --to=dturner@twopensource.com \
    --cc=barkalow@iabervon.iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.com \
    /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