]> git.ipfire.org Git - thirdparty/git.git/commitdiff
wildmatch: fix case-insensitive matching
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 15 Oct 2012 06:25:59 +0000 (13:25 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Oct 2012 21:58:18 +0000 (14:58 -0700)
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>
wildmatch.c

index eef7b13aa40f4de50c6e8dc92c612fbbc523019f..5469866e8ad82eb3a1d32f60c9ef72251e07bde3 100644 (file)
@@ -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