Use FugitiveConfig() to retrieve config vars

This commit is contained in:
Tim Pope
2019-10-14 16:30:05 -04:00
parent d1f18371f5
commit 5130596a65

View File

@@ -66,8 +66,8 @@ endfunction
function! s:credentials() abort function! s:credentials() abort
if !exists('g:github_user') if !exists('g:github_user')
let g:github_user = $GITHUB_USER let g:github_user = $GITHUB_USER
if g:github_user ==# '' if g:github_user ==# '' && exists('*FugitiveConfig')
let g:github_user = system('git config --get github.user')[0:-2] let g:github_user = FugitiveConfig('github.user', '')
endif endif
if g:github_user ==# '' if g:github_user ==# ''
let g:github_user = $LOGNAME let g:github_user = $LOGNAME
@@ -75,8 +75,8 @@ function! s:credentials() abort
endif endif
if !exists('g:github_password') if !exists('g:github_password')
let g:github_password = $GITHUB_PASSWORD let g:github_password = $GITHUB_PASSWORD
if g:github_password ==# '' if g:github_password ==# '' && exists('*FugitiveConfig')
let g:github_password = system('git config --get github.password')[0:-2] let g:github_password = FugitiveConfig('github.password', '')
endif endif
endif endif
return g:github_user.':'.g:github_password return g:github_user.':'.g:github_password