wildmatch: fix case-insensitive matching
dowild() does case insensitive matching by lower-casing the text. That means lower case letters in patterns imply case-insensitive matching, but upper case means exact matching. We do not want that subtlety. Lower case pattern too so iwildmatch() always does what we expect it to do. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Oct 15, 2012 at 13:25 UTC
164bf83af6466e03b306b9d63dcf7d36dda2bdae
1 file changed
+2
wildmatch.c
+2
@@ -71,6 +71,8 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
71
return ABORT_ALL;
72
if (force_lower_case && ISUPPER(t_ch))
73
t_ch = tolower(t_ch);
74
+ if (force_lower_case && ISUPPER(p_ch))
75
+ p_ch = tolower(p_ch);
76
switch (p_ch) {
77
case '\\':
78
/* Literal match with following character. Note that the test