diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2013-01-01 09:44:02 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-01 15:31:18 -0800 |
commit | 3a078dec3327fb68faa7c800040f89db3e38e6e5 (patch) | |
tree | 368d0819941fd8758a932776e07aaf975fc4bc6d /t/t3070-wildmatch.sh | |
parent | d5d80e12bd755197352bdb0e9b2291c896946abd (diff) | |
download | git-3a078dec3327fb68faa7c800040f89db3e38e6e5.tar.gz |
wildmatch: fix "**" special case
"**" is adjusted to only be effective when surrounded by slashes, in
40bbee0 (wildmatch: adjust "**" behavior - 2012-10-15). Except that
the commit did it wrong:
1. when it checks for "the preceding slash unless ** is at the
beginning", it compares to wrong pointer. It should have compared
to the beginning of the pattern, not the text.
2. prev_p points to the character before "**", not the first "*". The
correct comparison must be "prev_p < pattern" or
"prev_p + 1 == pattern", not "prev_p == pattern".
3. The pattern must be surrounded by slashes unless it's at the
beginning or the end of the pattern. We do two checks: one for the
preceding slash and one the trailing slash. Both checks must be
met. The use of "||" is wrong.
This patch fixes all above.
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-x | t/t3070-wildmatch.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh index d5bafefbe2..af54c83111 100755 --- a/t/t3070-wildmatch.sh +++ b/t/t3070-wildmatch.sh @@ -83,7 +83,7 @@ match 0 0 'deep/foo/bar/baz/' '**/bar/*' match 1 0 'deep/foo/bar/baz/' '**/bar/**' match 0 0 'deep/foo/bar' '**/bar/*' match 1 0 'deep/foo/bar/' '**/bar/**' -match 1 0 'foo/bar/baz' '**/bar**' +match 0 0 'foo/bar/baz' '**/bar**' match 1 0 'foo/bar/baz/x' '*/bar/**' match 0 0 'deep/foo/bar/baz/x' '*/bar/**' match 1 0 'deep/foo/bar/baz/x' '**/bar/*/*' |