summaryrefslogtreecommitdiff
path: root/wildmatch.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-10-15 13:25:59 +0700
committerJunio C Hamano <gitster@pobox.com>2012-10-15 14:58:18 -0700
commit164bf83af6466e03b306b9d63dcf7d36dda2bdae (patch)
treeb4558726dd695bfab132d58215b5cb059114e459 /wildmatch.c
parent9b4edc0a49abd4b5c6505c63c8fa40d527df6ae8 (diff)
downloadgit-164bf83af6466e03b306b9d63dcf7d36dda2bdae.tar.gz
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>
Diffstat (limited to 'wildmatch.c')
-rw-r--r--wildmatch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/wildmatch.c b/wildmatch.c
index eef7b13aa4..5469866e8a 100644
--- a/wildmatch.c
+++ b/wildmatch.c
@@ -71,6 +71,8 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
return ABORT_ALL;
if (force_lower_case && ISUPPER(t_ch))
t_ch = tolower(t_ch);
+ if (force_lower_case && ISUPPER(p_ch))
+ p_ch = tolower(p_ch);
switch (p_ch) {
case '\\':
/* Literal match with following character. Note that the test