]> granicus.if.org Git - vim/commitdiff
patch 8.2.2430: :vimgrep expands wildcards twice v8.2.2430
authorBram Moolenaar <Bram@vim.org>
Sat, 30 Jan 2021 17:09:06 +0000 (18:09 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 30 Jan 2021 17:09:06 +0000 (18:09 +0100)
Problem:    :vimgrep expands wildcards twice.
Solution:   Do not expand wildcards a second time.

src/arglist.c
src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 117116cd5d0a63c31ad73ae2c3dd093e30f5a694..503cbd90df94bfa21bb3b8275dc51990335e7923 100644 (file)
@@ -315,10 +315,10 @@ get_arglist_exp(
        return FAIL;
     if (wig == TRUE)
        i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
-                                       fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
+                            fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
     else
        i = gen_expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
-                                       fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
+                            fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
 
     ga_clear(&ga);
     return i;
index f22d2bf3cdb2b623c0557b253e6fb6c8df858f41..742a1ee71332415f05d36373659b9d07d527190a 100644 (file)
@@ -6053,7 +6053,7 @@ vgr_process_args(
        return FAIL;
     }
 
-    // parse the list of arguments
+    // Parse the list of arguments, wildcards have already been expanded.
     if (get_arglist_exp(p, &args->fcount, &args->fnames, TRUE) == FAIL)
        return FAIL;
     if (args->fcount == 0)
index 1799f2990bac3e16c0a3875b18b664db48bf5a9a..6826acfd05693fab3695a87026c06630b17f6bca 100644 (file)
@@ -2865,6 +2865,13 @@ func Test_vimgrep()
   call XvimgrepTests('l')
 endfunc
 
+func Test_vimgrep_wildcards_expanded_once()
+  new X[id-01] file.txt
+  call setline(1, 'some text to search for')
+  vimgrep text %
+  bwipe!
+endfunc
+
 " Test for incsearch highlighting of the :vimgrep pattern
 " This test used to cause "E315: ml_get: invalid lnum" errors.
 func Test_vimgrep_incsearch()
index 52fa66399748c80513cd8f233520f4a0bd9334d0..56a0797562144988f40d8d8c18327a17fe6b4f2f 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2430,
 /**/
     2429,
 /**/