Re: [PATCH v3] refs: loosen restrictions on wildcard '*' refspecs

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

 



On Wed, Jul 22, 2015 at 11:21 AM, David Turner <dturner@xxxxxxxxxxxxxxxx> wrote:
> On Wed, 2015-07-22 at 09:06 -0700, Jacob Keller wrote:
>> From: Jacob Keller <jacob.keller@xxxxxxxxx>
>>
>> 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@xxxxxxxxx>
>> Cc: Daniel Barkalow <barkalow@xxxxxxxxxxxxxxxxxxxxx>
>> Cc: Junio C Hamano <gitster@xxxxxxxxx>
>> ---
>>
>> 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).
>
>
>

Ok that makes sense

Regards,
Jake
--
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]