Default pull ref to branch of same name

If we defaulted branch.x.remote to "origin", then we should also default
branch.x.merge to the obvious choice.  Otherwise we can end up in the
situation of a push ref without a pull ref, which leads to a rather
confusing "Push" header without a "Merge"/"Rebase" header.

References: https://github.com/tpope/vim-fugitive/issues/2129
This commit is contained in:
Tim Pope
2023-03-07 14:45:05 -05:00
parent c9c08ff9ef
commit f75dbb1967

View File

@@ -2823,7 +2823,7 @@ function! fugitive#BufReadStatus(...) abort
elseif fetch_remote ==# '.'
let pull_ref = FugitiveConfigGet('branch.' . branch . '.merge', config)
else
let pull_ref = substitute(FugitiveConfigGet('branch.' . branch . '.merge', config), '^refs/heads/', 'refs/remotes/' . fetch_remote . '/', '')
let pull_ref = substitute(config.Get('branch.' . branch . '.merge', 'refs/heads/' . branch), '^refs/heads/', 'refs/remotes/' . fetch_remote . '/', '')
endif
if len(pull_ref)
let rebase = FugitiveConfigGet('branch.' . branch . '.rebase', config)