Move pull_type into stat

This commit is contained in:
Tim Pope
2024-03-02 11:52:28 -05:00
parent 85eef8003e
commit 16ffd9623e

View File

@@ -2881,7 +2881,6 @@ function! fugitive#BufReadStatus(cmdbang) abort
let push_remote = ''
endif
let pull_type = 'Pull'
if empty(fetch_remote) || empty(branch)
let pull_ref = ''
elseif fetch_remote ==# '.'
@@ -2889,15 +2888,17 @@ function! fugitive#BufReadStatus(cmdbang) abort
else
let pull_ref = substitute(config.Get('branch.' . branch . '.merge', ''), '^refs/heads/', 'refs/remotes/' . fetch_remote . '/', '')
endif
let stat.pull_type = 'Pull'
if len(pull_ref)
let rebase = FugitiveConfigGet('branch.' . branch . '.rebase', config)
if empty(rebase)
let rebase = FugitiveConfigGet('pull.rebase', config)
endif
if rebase =~# '^\%(true\|yes\|on\|1\|interactive\|merges\|preserve\)$'
let pull_type = 'Rebase'
let stat.pull_type = 'Rebase'
elseif rebase =~# '^\%(false\|no|off\|0\|\)$'
let pull_type = 'Merge'
let stat.pull_type = 'Merge'
endif
endif
@@ -2973,7 +2974,7 @@ function! fugitive#BufReadStatus(cmdbang) abort
let stat.expanded = {'Staged': {}, 'Unstaged': {}}
let to = {'lines': []}
call s:AddHeader(to, 'Head', head)
call s:AddHeader(to, pull_type, pull_short)
call s:AddHeader(to, stat.pull_type, pull_short)
if push_ref !=# pull_ref
call s:AddHeader(to, 'Push', push_short)
endif