mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-08 13:04:51 +08: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,10 +6248,16 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
|
|||||||
let remote = r
|
let remote = r
|
||||||
endif
|
endif
|
||||||
if r ==# '.' || r ==# remote
|
if r ==# '.' || r ==# remote
|
||||||
|
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
|
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
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
let merge = branch
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user