changeset 23778:8b682f6f3709 v8.2.2430

patch 8.2.2430: :vimgrep expands wildcards twice Commit: https://github.com/vim/vim/commit/f8c6a1718007432812184c28495e8d27ee6c0395 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 30 18:09:06 2021 +0100 patch 8.2.2430: :vimgrep expands wildcards twice Problem: :vimgrep expands wildcards twice. Solution: Do not expand wildcards a second time.
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 Jan 2021 18:15:04 +0100
parents 047036413343
children e24b182c5646
files src/arglist.c src/quickfix.c src/testdir/test_quickfix.vim src/version.c
diffstat 4 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -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;
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -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)
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -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()
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2430,
+/**/
     2429,
 /**/
     2428,