summaryrefslogtreecommitdiff
path: root/t/t3070-wildmatch.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-10-15 06:26:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-10-15 21:58:18 (GMT)
commit40bbee0ab07d0ee4f21b11d597c878245c1b05a6 (patch)
treea966918d4df85bb7a398d4b37286b4ba731b7e98 /t/t3070-wildmatch.sh
parent164bf83af6466e03b306b9d63dcf7d36dda2bdae (diff)
downloadgit-40bbee0ab07d0ee4f21b11d597c878245c1b05a6.zip
git-40bbee0ab07d0ee4f21b11d597c878245c1b05a6.tar.gz
git-40bbee0ab07d0ee4f21b11d597c878245c1b05a6.tar.bz2
wildmatch: adjust "**" behavior
Standard wildmatch() sees consecutive asterisks as "*" that can also match slashes. But that may be hard to explain to users as "abc/**/def" can match "abcdef", "abcxyzdef", "abc/def", "abc/x/def", "abc/x/y/def"... This patch changes wildmatch so that users can do - "**/def" -> all paths ending with file/directory 'def' - "abc/**" - equivalent to "/abc/" - "abc/**/def" -> "abc/x/def", "abc/x/y/def"... - otherwise consider the pattern malformed if "**" is found Basically the magic of "**" only remains if it's wrapped around by slashes. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3070-wildmatch.sh')
-rwxr-xr-xt/t3070-wildmatch.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index dd95b00..15848d5 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -46,7 +46,7 @@ match 0 0 foobar 'foo\*bar'
match 1 1 'f\oo' 'f\\oo'
match 1 1 ball '*[al]?'
match 0 0 ten '[ten]'
-match 1 1 ten '**[!te]'
+match 0 1 ten '**[!te]'
match 0 0 ten '**[!ten]'
match 1 1 ten 't[a-g]n'
match 0 0 ten 't[!a-g]n'
@@ -61,7 +61,8 @@ match 1 1 ']' ']'
# Extended slash-matching features
match 0 0 'foo/baz/bar' 'foo*bar'
-match 1 0 'foo/baz/bar' 'foo**bar'
+match 0 0 'foo/baz/bar' 'foo**bar'
+match 0 1 'foobazbar' 'foo**bar'
match 0 0 'foo/bar' 'foo?bar'
match 0 0 'foo/bar' 'foo[/]bar'
match 0 0 'foo/bar' 'f[^eiu][^eiu][^eiu][^eiu][^eiu]r'