mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Use local not upstream branch name for :GBrowse default
When I first wrote this code, I believed push.default=upstream to be the One True Way, and I used the upstream as the default branch when one wasn't passed into :GBrowse. Since then, my preferred workflow has shifted to push.default=current, with my upstream pointed at the repository's integration branch (typically master), which means :GBrowse effectively ignores our current branch, which is less than helpful. This change eliminates :GBrowse's use of the upstream tracking branch except in 2 scenarios: * When push.default=upstream * When the current branch has never been pushed (since using the current branch would result in a 404).
This commit is contained in:
@@ -6248,9 +6248,15 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
|
||||
let remote = r
|
||||
endif
|
||||
if r ==# '.' || r ==# remote
|
||||
let merge = m
|
||||
if path =~# '^\.git/refs/heads/.'
|
||||
let path = '.git/refs/heads/'.merge
|
||||
let remote_ref = 'refs/remotes/' . remote . '/' . branch
|
||||
if FugitiveConfigGet('push.default', dir) ==# 'upstream' ||
|
||||
\ !filereadable(FugitiveFind('.git/' . remote_ref)) && s:ChompError(['rev-parse', '--verify', remote_ref, '--'], dir)[1]
|
||||
let merge = m
|
||||
if path =~# '^\.git/refs/heads/.'
|
||||
let path = '.git/refs/heads/'.merge
|
||||
endif
|
||||
else
|
||||
let merge = branch
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user