mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 13:23:52 -05:00
Handle non-config dictionary passed to FugitiveConfig()
This commit is contained in:
@@ -96,25 +96,26 @@ function! FugitivePrepare(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitiveConfig(...) abort
|
function! FugitiveConfig(...) abort
|
||||||
if a:0 == 2 && type(a:2) != type({})
|
if a:0 == 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir'))
|
||||||
return fugitive#Config(a:1, FugitiveGitDir(a:2))
|
return fugitive#Config(a:1, FugitiveGitDir(a:2))
|
||||||
elseif a:0 == 1 && a:1 !~# '^[[:alnum:]-]\+\.'
|
elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.')
|
||||||
return fugitive#Config(FugitiveGitDir(a:1))
|
return fugitive#Config(FugitiveGitDir(a:1))
|
||||||
else
|
else
|
||||||
return call('fugitive#Config', a:000)
|
return call('fugitive#Config', a:000)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Retrieve a Git configuration value. An optional second argument provides
|
" FugitiveConfigGet() retrieves a Git configuration value. An optional second
|
||||||
" the Git dir as with FugitiveFind(). Pass a blank string to limit to the
|
" argument provides the Git dir as with FugitiveFind(). Pass a blank string
|
||||||
" global config.
|
" to limit to the global config.
|
||||||
function! FugitiveConfigGet(name, ...) abort
|
function! FugitiveConfigGet(name, ...) abort
|
||||||
return call('FugitiveConfig', [a:name] + a:000)
|
return call('FugitiveConfig', [a:name] + a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Like FugitiveConfigGet(), but return a list of all values.
|
" FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of
|
||||||
|
" all values.
|
||||||
function! FugitiveConfigGetAll(name, ...) abort
|
function! FugitiveConfigGetAll(name, ...) abort
|
||||||
if a:0 && type(a:1) ==# type({})
|
if a:0 && type(a:1) ==# type({}) && !has_key(a:1, 'git_dir')
|
||||||
let config = a:1
|
let config = a:1
|
||||||
else
|
else
|
||||||
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
|
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
|
||||||
|
|||||||
Reference in New Issue
Block a user