commit 1a4552da8d2cce62ff62baef9787badb550264bb (tree)
parent 22fff8213ed62e1e457689f0635f2ead752d7562
Author: Tim Pope <code@tpope.net>
Date: Mon, 23 Aug 2021 01:43:23 -0400
Support :Ggrep --no-index/--no-cached
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -5241,8 +5241,9 @@ let s:grep_combine_flags = '[aiIrhHEGPFnlLzocpWq]\{-\}'
function! s:GrepOptions(args, dir) abort
let options = {'name_only': 0, 'name_count': 0, 'line_number': 0}
let tree = s:Tree(a:dir)
- let options.prefix = empty(tree) ? fugitive#Find(':0:', a:dir) :
+ let prefix = empty(tree) ? fugitive#Find(':0:', a:dir) :
\ s:cpath(getcwd(), tree) ? '' : FugitiveVimPath(tree . '/')
+ let options.prefix = prefix
for arg in a:args
if arg ==# '--'
break
@@ -5260,6 +5261,8 @@ function! s:GrepOptions(args, dir) abort
endif
if arg ==# '--cached'
let options.prefix = fugitive#Find(':0:', a:dir)
+ elseif arg ==# '--no-cached'
+ let options.prefix = prefix
endif
endfor
return options
@@ -5317,7 +5320,6 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort
if !handle
return {}
endif
- exe s:DirCheck(a:options)
let listnr = a:line1 == 0 ? a:line1 : a:line2
let cmd = ['grep', '-n', '--no-color', '--full-name']
let dir = s:Dir(a:options)
@@ -5336,7 +5338,7 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort
\ 'args': cmd + args,
\ 'dir': s:GitDir(a:options),
\ 'git_dir': s:GitDir(a:options),
- \ 'cwd': s:UserCommandCwd(dir),
+ \ 'cwd': s:UserCommandCwd(a:options),
\ 'filetype': 'git',
\ 'mods': s:Mods(a:mods),
\ 'file': s:Resolve(tempfile)}