Skip to content

Commit 164bf83

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent 9b4edc0 commit 164bf83

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

wildmatch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
7171
return ABORT_ALL;
7272
if (force_lower_case && ISUPPER(t_ch))
7373
t_ch = tolower(t_ch);
74+
if (force_lower_case && ISUPPER(p_ch))
75+
p_ch = tolower(p_ch);
7476
switch (p_ch) {
7577
case '\\':
7678
/* Literal match with following character. Note that the test

0 commit comments

Comments
 (0)