wildmatch: properly fold case everywhere
commitb79c0c3755f3694a3c7ecd3cad18bda011283db7
authorAnthony Ramine <n.oxyde@gmail.com>
Thu, 30 May 2013 10:19:10 +0000 (30 12:19 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 2 Jun 2013 21:13:05 +0000 (2 14:13 -0700)
tree70ad6297951c02a5a2d8ae5a9f1fd06beec704c0
parentedca4152560522a431a51fc0a06147fc680b5b18
wildmatch: properly fold case everywhere

Case folding is not done correctly when matching against the [:upper:]
character class and uppercased character ranges (e.g. A-Z).
Specifically, an uppercase letter fails to match against any of them
when case folding is requested because plain characters in the pattern
and the whole string are preemptively lowercased to handle the base case
fast.

That optimization is kept and ISLOWER() is used in the [:upper:] case
when case folding is requested, while matching against a character range
is retried with toupper() if the character was lowercase, as the bounds
of the range itself cannot be modified (in a case-insensitive context,
[A-_] is not equivalent to [a-_]).

Signed-off-by: Anthony Ramine <n.oxyde@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3070-wildmatch.sh
wildmatch.c