# [PATCH v2] wildmatch test: cover a blind spot in "/" matching

2 messages from 2017-06-15 to 2017-06-15. Participants: Ævar Arnfjörð Bjarmason, Junio C Hamano.
Thread: https://gitlist.dev/t/46194

## Ævar Arnfjörð Bjarmason, 2017-06-15 21:10

Subject: [PATCH v2] wildmatch test: cover a blind spot in "/" matching
Message-ID: <20170615211041.22768-1-avarab@gmail.com>
URL: https://gitlist.dev/e/20170615211041.22768-1-avarab%40gmail.com
In-Reply-To: <CAPc5daWy3eq-ODwDSbvhvRPH87QR0WMttZQUhmKfcZxs4qvdaQ@mail.gmail.com>

```
A negated character class that does not include '/', e.g. [^a-z]:

 - Should match '/' when doing "wildmatch"
 - Should not match '/' when doing "pathmatch"

Add two tests to cover these cases.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

Now with updated commit message, no other changes. Sorry about the
delay.

 t/t3070-wildmatch.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index 7ca69f4bed..8fd70d3aa2 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -82,6 +82,7 @@ match 1 0 'foo/bar' 'foo/**/bar'
 match 1 0 'foo/bar' 'foo/**/**/bar'
 match 0 0 'foo/bar' 'foo?bar'
 match 0 0 'foo/bar' 'foo[/]bar'
+match 0 0 'foo/bar' 'foo[^a-z]bar'
 match 0 0 'foo/bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
 match 1 1 'foo-bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
 match 1 0 'foo' '**/foo'
@@ -225,6 +226,7 @@ pathmatch 0 foo/bba/arr 'foo/*z'
 pathmatch 0 foo/bba/arr 'foo/**z'
 pathmatch 1 foo/bar 'foo?bar'
 pathmatch 1 foo/bar 'foo[/]bar'
+pathmatch 1 foo/bar 'foo[^a-z]bar'
 pathmatch 0 foo '*/*/*'
 pathmatch 0 foo/bar '*/*/*'
 pathmatch 1 foo/bba/arr '*/*/*'
-- 
2.13.1.508.gb3defc5cc


```

## Junio C Hamano, 2017-06-15 22:01

Subject: Re: [PATCH v2] wildmatch test: cover a blind spot in "/" matching
Message-ID: <xmqq60fwzz9y.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq60fwzz9y.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20170615211041.22768-1-avarab@gmail.com>

```
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> A negated character class that does not include '/', e.g. [^a-z]:
>
>  - Should match '/' when doing "wildmatch"
>  - Should not match '/' when doing "pathmatch"
>
> Add two tests to cover these cases.
>
> Helped-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>
> Now with updated commit message, no other changes. Sorry about the
> delay.

Thanks.  I completely forgot about this topic ;-)

>
>  t/t3070-wildmatch.sh | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
> index 7ca69f4bed..8fd70d3aa2 100755
> --- a/t/t3070-wildmatch.sh
> +++ b/t/t3070-wildmatch.sh
> @@ -82,6 +82,7 @@ match 1 0 'foo/bar' 'foo/**/bar'
>  match 1 0 'foo/bar' 'foo/**/**/bar'
>  match 0 0 'foo/bar' 'foo?bar'
>  match 0 0 'foo/bar' 'foo[/]bar'
> +match 0 0 'foo/bar' 'foo[^a-z]bar'
>  match 0 0 'foo/bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
>  match 1 1 'foo-bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'
>  match 1 0 'foo' '**/foo'
> @@ -225,6 +226,7 @@ pathmatch 0 foo/bba/arr 'foo/*z'
>  pathmatch 0 foo/bba/arr 'foo/**z'
>  pathmatch 1 foo/bar 'foo?bar'
>  pathmatch 1 foo/bar 'foo[/]bar'
> +pathmatch 1 foo/bar 'foo[^a-z]bar'
>  pathmatch 0 foo '*/*/*'
>  pathmatch 0 foo/bar '*/*/*'
>  pathmatch 1 foo/bba/arr '*/*/*'

```
