mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 21:33:53 -05:00
Homogenize calls to private exec helpers
Replace calls of the form f(dir, arg1, arg2) with f([dir, arg1, arg2]).
This commit is contained in:
@@ -1928,7 +1928,7 @@ function! s:CompleteSub(subcommand, A, L, P, ...) abort
|
|||||||
if pre =~# ' -- '
|
if pre =~# ' -- '
|
||||||
return fugitive#CompletePath(a:A)
|
return fugitive#CompletePath(a:A)
|
||||||
elseif a:A =~# '^-' || a:A is# 0
|
elseif a:A =~# '^-' || a:A is# 0
|
||||||
return s:FilterEscape(split(s:ChompDefault('', a:subcommand, '--git-completion-helper'), ' '), a:A)
|
return s:FilterEscape(split(s:ChompDefault('', [a:subcommand, '--git-completion-helper']), ' '), a:A)
|
||||||
elseif !a:0
|
elseif !a:0
|
||||||
return fugitive#CompleteObject(a:A, s:Dir())
|
return fugitive#CompleteObject(a:A, s:Dir())
|
||||||
elseif type(a:1) == type(function('tr'))
|
elseif type(a:1) == type(function('tr'))
|
||||||
@@ -2428,7 +2428,7 @@ function! fugitive#BufReadCmd(...) abort
|
|||||||
else
|
else
|
||||||
let [b:fugitive_type, exec_error] = s:ChompError([dir, 'cat-file', '-t', rev])
|
let [b:fugitive_type, exec_error] = s:ChompError([dir, 'cat-file', '-t', rev])
|
||||||
if exec_error && rev =~# '^:0'
|
if exec_error && rev =~# '^:0'
|
||||||
let sha = s:ChompDefault('', dir, 'write-tree', '--prefix=' . rev[3:-1])
|
let sha = s:ChompDefault('', [dir, 'write-tree', '--prefix=' . rev[3:-1]])
|
||||||
let exec_error = empty(sha)
|
let exec_error = empty(sha)
|
||||||
let b:fugitive_type = exec_error ? '' : 'tree'
|
let b:fugitive_type = exec_error ? '' : 'tree'
|
||||||
endif
|
endif
|
||||||
@@ -3220,7 +3220,7 @@ function! s:CompletableSubcommands(dir) abort
|
|||||||
let c_exec_path = s:cpath(s:ExecPath())
|
let c_exec_path = s:cpath(s:ExecPath())
|
||||||
if !has_key(s:path_subcommands, c_exec_path)
|
if !has_key(s:path_subcommands, c_exec_path)
|
||||||
if fugitive#GitVersion(2, 18)
|
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'])
|
||||||
call filter(lines, 'v:val =~# "^\\S\\+$"')
|
call filter(lines, 'v:val =~# "^\\S\\+$"')
|
||||||
if !exec_error && len(lines)
|
if !exec_error && len(lines)
|
||||||
let s:path_subcommands[c_exec_path] = lines
|
let s:path_subcommands[c_exec_path] = lines
|
||||||
@@ -3283,7 +3283,7 @@ function! fugitive#Complete(lead, ...) abort
|
|||||||
elseif pre =~# ' -- '
|
elseif pre =~# ' -- '
|
||||||
return fugitive#CompletePath(a:lead, a:1, a:2, dir, root)
|
return fugitive#CompletePath(a:lead, a:1, a:2, dir, root)
|
||||||
elseif a:lead =~# '^-'
|
elseif a:lead =~# '^-'
|
||||||
let results = split(s:ChompDefault('', dir, subcmd, '--git-completion-helper'), ' ')
|
let results = split(s:ChompDefault('', [dir, subcmd, '--git-completion-helper']), ' ')
|
||||||
else
|
else
|
||||||
return fugitive#CompleteObject(a:lead, a:1, a:2, dir, root)
|
return fugitive#CompleteObject(a:lead, a:1, a:2, dir, root)
|
||||||
endif
|
endif
|
||||||
@@ -5567,7 +5567,7 @@ function! s:CompareAge(mine, theirs) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:IsConflicted() abort
|
function! s:IsConflicted() abort
|
||||||
return len(@%) && !empty(s:ChompDefault('', 'ls-files', '--unmerged', '--', expand('%:p')))
|
return len(@%) && !empty(s:ChompDefault('', ['ls-files', '--unmerged', '--', expand('%:p')]))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort
|
function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort
|
||||||
@@ -5833,7 +5833,7 @@ function! s:BlameCommitFileLnum(...) abort
|
|||||||
if commit =~# '^0\+$'
|
if commit =~# '^0\+$'
|
||||||
let commit = ''
|
let commit = ''
|
||||||
elseif has_key(state, 'blame_reverse_end')
|
elseif has_key(state, 'blame_reverse_end')
|
||||||
let commit = get(s:LinesError(state.dir, 'rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, '')
|
let commit = get(s:LinesError([state.dir, 'rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end])[0], 0, '')
|
||||||
endif
|
endif
|
||||||
let lnum = +matchstr(line, ' \zs\d\+\ze \%((\| *\d\+)\)')
|
let lnum = +matchstr(line, ' \zs\d\+\ze \%((\| *\d\+)\)')
|
||||||
let path = matchstr(line, '^\^\=[?*]*\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s*\d\+ \%((\| *\d\+)\)')
|
let path = matchstr(line, '^\^\=[?*]*\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s*\d\+ \%((\| *\d\+)\)')
|
||||||
|
|||||||
Reference in New Issue
Block a user