mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 23:03:51 -05:00
Unify use of FugitiveConfig helpers
This commit is contained in:
@@ -665,11 +665,11 @@ endfunction
|
|||||||
|
|
||||||
function! s:Remote(dir) abort
|
function! s:Remote(dir) abort
|
||||||
let head = FugitiveHead(0, a:dir)
|
let head = FugitiveHead(0, a:dir)
|
||||||
let remote = len(head) ? fugitive#Config('branch.' . head . '.remote') : ''
|
let remote = len(head) ? FugitiveConfigGet('branch.' . head . '.remote', dir) : ''
|
||||||
let i = 10
|
let i = 10
|
||||||
while remote ==# '.' && i > 0
|
while remote ==# '.' && i > 0
|
||||||
let head = matchstr(fugitive#Config('branch.' . head . '.merge'), 'refs/heads/\zs.*')
|
let head = matchstr(FugitiveConfigGet('branch.' . head . '.merge', dir), 'refs/heads/\zs.*')
|
||||||
let remote = len(head) ? fugitive#Config('branch.' . head . '.remote') : ''
|
let remote = len(head) ? FugitiveConfigGet('branch.' . head . '.remote', dir) : ''
|
||||||
let i -= 1
|
let i -= 1
|
||||||
endwhile
|
endwhile
|
||||||
return remote =~# '^\.\=$' ? 'origin' : remote
|
return remote =~# '^\.\=$' ? 'origin' : remote
|
||||||
@@ -906,7 +906,7 @@ endfunction
|
|||||||
call s:add_methods('repo',['superglob'])
|
call s:add_methods('repo',['superglob'])
|
||||||
|
|
||||||
function! s:repo_config(name) dict abort
|
function! s:repo_config(name) dict abort
|
||||||
return fugitive#Config(a:name, self.git_dir)
|
return FugitiveConfigGet(a:name, self.git_dir)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:repo_user() dict abort
|
function! s:repo_user() dict abort
|
||||||
@@ -2011,9 +2011,9 @@ function! fugitive#BufReadStatus() abort
|
|||||||
|
|
||||||
let pull_type = 'Pull'
|
let pull_type = 'Pull'
|
||||||
if len(pull)
|
if len(pull)
|
||||||
let rebase = fugitive#Config('branch.' . branch . '.rebase', config)
|
let rebase = FugitiveConfigGet('branch.' . branch . '.rebase', config)
|
||||||
if empty(rebase)
|
if empty(rebase)
|
||||||
let rebase = fugitive#Config('pull.rebase', config)
|
let rebase = FugitiveConfigGet('pull.rebase', config)
|
||||||
endif
|
endif
|
||||||
if rebase =~# '^\%(true\|yes\|on\|1\|interactive\|merges\|preserve\)$'
|
if rebase =~# '^\%(true\|yes\|on\|1\|interactive\|merges\|preserve\)$'
|
||||||
let pull_type = 'Rebase'
|
let pull_type = 'Rebase'
|
||||||
@@ -2022,11 +2022,11 @@ function! fugitive#BufReadStatus() abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let push_remote = fugitive#Config('branch.' . branch . '.pushRemote', config)
|
let push_remote = FugitiveConfigGet('branch.' . branch . '.pushRemote', config)
|
||||||
if empty(push_remote)
|
if empty(push_remote)
|
||||||
let push_remote = fugitive#Config('remote.pushDefault', config)
|
let push_remote = FugitiveConfigGet('remote.pushDefault', config)
|
||||||
endif
|
endif
|
||||||
let fetch_remote = fugitive#Config('branch.' . branch . '.remote', config)
|
let fetch_remote = FugitiveConfigGet('branch.' . branch . '.remote', config)
|
||||||
if empty(fetch_remote)
|
if empty(fetch_remote)
|
||||||
let fetch_remote = 'origin'
|
let fetch_remote = 'origin'
|
||||||
endif
|
endif
|
||||||
@@ -2034,7 +2034,7 @@ function! fugitive#BufReadStatus() abort
|
|||||||
let push_remote = fetch_remote
|
let push_remote = fetch_remote
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let push_default = fugitive#Config('push.default')
|
let push_default = FugitiveConfigGet('push.default', config)
|
||||||
if empty(push_default)
|
if empty(push_default)
|
||||||
let push_default = fugitive#GitVersion(2) ? 'simple' : 'matching'
|
let push_default = fugitive#GitVersion(2) ? 'simple' : 'matching'
|
||||||
endif
|
endif
|
||||||
@@ -2851,7 +2851,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
|
|||||||
let cmd = s:StatusCommand(a:line1, a:line2, a:range, a:line2, a:bang, a:mods, '', '', [])
|
let cmd = s:StatusCommand(a:line1, a:line2, a:range, a:line2, a:bang, a:mods, '', '', [])
|
||||||
return (empty(cmd) ? 'exe' : cmd) . after
|
return (empty(cmd) ? 'exe' : cmd) . after
|
||||||
endif
|
endif
|
||||||
let alias = fugitive#Config('alias.' . get(args, 0, ''), config)
|
let alias = FugitiveConfigGet('alias.' . get(args, 0, ''), config)
|
||||||
if get(args, 1, '') !=# '--help' && alias !~# '^$\|^!\|[\"'']' && !filereadable(s:ExecPath() . '/git-' . args[0])
|
if get(args, 1, '') !=# '--help' && alias !~# '^$\|^!\|[\"'']' && !filereadable(s:ExecPath() . '/git-' . args[0])
|
||||||
\ && !(has('win32') && filereadable(s:ExecPath() . '/git-' . args[0] . '.exe'))
|
\ && !(has('win32') && filereadable(s:ExecPath() . '/git-' . args[0] . '.exe'))
|
||||||
call remove(args, 0)
|
call remove(args, 0)
|
||||||
@@ -3063,7 +3063,7 @@ function! s:CompletableSubcommands(dir) abort
|
|||||||
endif
|
endif
|
||||||
call extend(commands, s:path_subcommands[cpath])
|
call extend(commands, s:path_subcommands[cpath])
|
||||||
endfor
|
endfor
|
||||||
call extend(commands, map(filter(keys(fugitive#Config(a:dir)), 'v:val =~# "^alias\\.[^.]*$"'), 'strpart(v:val, 6)'))
|
call extend(commands, keys(FugitiveConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir)))
|
||||||
let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+')
|
let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+')
|
||||||
let rejected = {}
|
let rejected = {}
|
||||||
for command in configured
|
for command in configured
|
||||||
@@ -6287,7 +6287,7 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
|
|||||||
if r ==# '.' || r ==# remote
|
if r ==# '.' || r ==# remote
|
||||||
let remote_ref = 'refs/remotes/' . remote . '/' . branch
|
let remote_ref = 'refs/remotes/' . remote . '/' . branch
|
||||||
if FugitiveConfigGet('push.default', dir) ==# 'upstream' ||
|
if FugitiveConfigGet('push.default', dir) ==# 'upstream' ||
|
||||||
\ !filereadable(FugitiveFind('.git/' . remote_ref)) && s:ChompError(['rev-parse', '--verify', remote_ref, '--'], dir)[1]
|
\ !filereadable(FugitiveFind('.git/' . remote_ref, dir)) && s:ChompError(['rev-parse', '--verify', remote_ref, '--'], dir)[1]
|
||||||
let merge = m
|
let merge = m
|
||||||
if path =~# '^\.git/refs/heads/.'
|
if path =~# '^\.git/refs/heads/.'
|
||||||
let path = '.git/refs/heads/'.merge
|
let path = '.git/refs/heads/'.merge
|
||||||
|
|||||||
Reference in New Issue
Block a user