Move push_remote and fetch_remote into stat

This commit is contained in:
Tim Pope
2024-03-02 13:12:26 -05:00
parent 16ffd9623e
commit 840ce4a9d9

View File

@@ -2880,13 +2880,15 @@ function! fugitive#BufReadStatus(cmdbang) abort
if push_remote !=# '.' && empty(config.Get('remote.' . push_remote . '.push', config.Get('remote.' . push_remote . '.fetch'))) if push_remote !=# '.' && empty(config.Get('remote.' . push_remote . '.push', config.Get('remote.' . push_remote . '.fetch')))
let push_remote = '' let push_remote = ''
endif endif
let stat.fetch_remote = fetch_remote
let stat.push_remote = push_remote
if empty(fetch_remote) || empty(branch) if empty(stat.fetch_remote) || empty(branch)
let pull_ref = '' let pull_ref = ''
elseif fetch_remote ==# '.' elseif stat.fetch_remote ==# '.'
let pull_ref = config.Get('branch.' . branch . '.merge', '') let pull_ref = config.Get('branch.' . branch . '.merge', '')
else else
let pull_ref = substitute(config.Get('branch.' . branch . '.merge', ''), '^refs/heads/', 'refs/remotes/' . fetch_remote . '/', '') let pull_ref = substitute(config.Get('branch.' . branch . '.merge', ''), '^refs/heads/', 'refs/remotes/' . stat.fetch_remote . '/', '')
endif endif
let stat.pull_type = 'Pull' let stat.pull_type = 'Pull'
@@ -2908,12 +2910,12 @@ function! fugitive#BufReadStatus(cmdbang) abort
endif endif
if push_default ==# 'upstream' if push_default ==# 'upstream'
let push_ref = pull_ref let push_ref = pull_ref
elseif empty(push_remote) || empty(branch) elseif empty(stat.push_remote) || empty(branch)
let push_ref = '' let push_ref = ''
elseif push_remote ==# '.' elseif stat.push_remote ==# '.'
let push_ref = 'refs/heads/' . branch let push_ref = 'refs/heads/' . branch
else else
let push_ref = 'refs/remotes/' . push_remote . '/' . branch let push_ref = 'refs/remotes/' . stat.push_remote . '/' . branch
endif endif
let push_short = substitute(push_ref, '^refs/\w\+/', '', '') let push_short = substitute(push_ref, '^refs/\w\+/', '', '')
@@ -3010,7 +3012,7 @@ function! fugitive#BufReadStatus(cmdbang) abort
call s:AddLogSection(to, 'Unpushed to ' . push_short, unpushed_push) call s:AddLogSection(to, 'Unpushed to ' . push_short, unpushed_push)
call s:AddLogSection(to, 'Unpushed to ' . pull_short, unpushed_pull) call s:AddLogSection(to, 'Unpushed to ' . pull_short, unpushed_pull)
if unpushed_push.error && unpushed_pull.error && empty(rebasing) && if unpushed_push.error && unpushed_pull.error && empty(rebasing) &&
\ !empty(push_remote . fetch_remote) \ !empty(stat.push_remote . stat.fetch_remote)
call s:AddLogSection(to, 'Unpushed to *', s:QueryLog([head, '--not', '--remotes'], 256, dir)) call s:AddLogSection(to, 'Unpushed to *', s:QueryLog([head, '--not', '--remotes'], 256, dir))
endif endif
call s:AddLogSection(to, 'Unpulled from ' . push_short, s:QueryLogRange(head, unique_push_ref, dir)) call s:AddLogSection(to, 'Unpulled from ' . push_short, s:QueryLogRange(head, unique_push_ref, dir))