Use --list-cmds=others instead of hunting through PATH

Resolves: https://github.com/tpope/vim-fugitive/issues/2458
This commit is contained in:
Tim Pope
2026-03-07 14:15:53 -05:00
parent 045d2de2d7
commit 3b753cf8c6

View File

@@ -4106,7 +4106,7 @@ function! s:CompletableSubcommands(dir) abort
let c_exec_path = s:cpath(s:VimExecPath())
if !has_key(s:path_subcommands, c_exec_path)
if fugitive#GitVersion(2, 18)
let [lines, exec_error] = s:LinesError([a:dir, '--list-cmds=list-mainporcelain,nohelpers,list-complete'])
let [lines, exec_error] = s:LinesError([a:dir, '--list-cmds=list-mainporcelain,nohelpers,list-complete,others'])
call filter(lines, 'v:val =~# "^\\S\\+$"')
if !exec_error && len(lines)
let s:path_subcommands[c_exec_path] = lines
@@ -4120,16 +4120,6 @@ function! s:CompletableSubcommands(dir) abort
endif
endif
let commands = copy(s:path_subcommands[c_exec_path])
for path in split($PATH, has('win32') ? ';' : ':')
if path !~# '^/\|^\a:[\\/]'
continue
endif
let cpath = s:cpath(path)
if !has_key(s:path_subcommands, cpath)
let s:path_subcommands[cpath] = filter(map(s:GlobComplete(path.'/git-', '*', 1),'substitute(v:val,"\\.exe$","","")'), 'v:val !~# "--\\|/"')
endif
call extend(commands, s:path_subcommands[cpath])
endfor
call extend(commands, keys(fugitive#ConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir)))
let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+')
let rejected = {}