mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Make prepare functions idempotent
This is limited to the single argument case so as not to interfere with using an old command result to seed the Git dir for a new command.
This commit is contained in:
@@ -420,6 +420,13 @@ function! fugitive#PrepareDirEnvGitFlagsArgs(...) abort
|
|||||||
throw 'fugitive: Git 1.8.5 or higher required'
|
throw 'fugitive: Git 1.8.5 or higher required'
|
||||||
endif
|
endif
|
||||||
let git = s:GitCmd()
|
let git = s:GitCmd()
|
||||||
|
if a:0 == 1 && type(a:1) == type({}) && has_key(a:1, 'git_dir') && has_key(a:1, 'flags') && has_key(a:1, 'args')
|
||||||
|
let cmd = a:1.flags + a:1.args
|
||||||
|
let dir = a:1.git_dir
|
||||||
|
if has_key(a:1, 'git')
|
||||||
|
let git = a:1.git
|
||||||
|
endif
|
||||||
|
else
|
||||||
let list_args = []
|
let list_args = []
|
||||||
let cmd = []
|
let cmd = []
|
||||||
for arg in a:000
|
for arg in a:000
|
||||||
@@ -430,6 +437,7 @@ function! fugitive#PrepareDirEnvGitFlagsArgs(...) abort
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
call extend(cmd, list_args)
|
call extend(cmd, list_args)
|
||||||
|
endif
|
||||||
let env = {}
|
let env = {}
|
||||||
let i = 0
|
let i = 0
|
||||||
let arg_count = 0
|
let arg_count = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user