]> granicus.if.org Git - vim/commitdiff
patch 8.2.4671: 'wildignorecase' is sometimes not used for glob() v8.2.4671
authorLemonBoy <thatlemon@gmail.com>
Sun, 3 Apr 2022 10:58:31 +0000 (11:58 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 3 Apr 2022 10:58:31 +0000 (11:58 +0100)
Problem:    'wildignorecase' is sometimes not used for glob().
Solution:   Also use 'wildignorecase' when there are no wildcards.
            (closes #10066, closes #8350)

src/filepath.c
src/testdir/test_functions.vim
src/version.c

index 851091e57a315946cc10700ad00a691f89c8a62e..5bf31ea8e82e0b5cd6e42776e518d664dacff2f2 100644 (file)
@@ -3945,13 +3945,13 @@ gen_expand_wildcards(
            }
 
            /*
-            * If there are wildcards: Expand file names and add each match to
-            * the list.  If there is no match, and EW_NOTFOUND is given, add
-            * the pattern.
-            * If there are no wildcards: Add the file name if it exists or
-            * when EW_NOTFOUND is given.
+            * If there are wildcards or case-insensitive expansion is
+            * required: Expand file names and add each match to the list.  If
+            * there is no match, and EW_NOTFOUND is given, add the pattern.
+            * Otherwise: Add the file name if it exists or when EW_NOTFOUND is
+            * given.
             */
-           if (mch_has_exp_wildcard(p))
+           if (mch_has_exp_wildcard(p) || (flags & EW_ICASE))
            {
 #if defined(FEAT_SEARCHPATH)
                if ((flags & EW_PATH)
index fddf4aeb6393e5348c8aafa3d860811f548f0eae..a19dd52719a4785a13d89f4856ddf7ad5264d756 100644 (file)
@@ -2821,6 +2821,8 @@ func Test_glob()
   " Sort output of glob() otherwise we end up with different
   " ordering depending on whether file system is case-sensitive.
   call assert_equal(['XGLOB2', 'Xglob1'], sort(glob('Xglob[12]', 0, 1)))
+  " wildignorecase shall be applied even when the pattern contains no wildcards.
+  call assert_equal('XGLOB2', glob('xglob2'))
   set wildignorecase&
 
   call delete('Xglob1')
index 487a134d090c827a2a065653fbf93fc1c5da7a1d..c6111fc92d6000590c9313b0056dd64be57145ac 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4671,
 /**/
     4670,
 /**/