motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 1e41a88ec9d71d1c8de615acaf509609bff2d99a (tree)
parent 9e7b67e9b054f2935f95718aaea94a4c38723140
Author: Tim Pope <code@tpope.net>
Date:   Sat, 21 Jul 2018 19:02:31 -0400

Default to branch remote rather than origin

Diffstat:
Mautoload/fugitive.vim | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -130,9 +130,21 @@ function! fugitive#Config(name, ...) abort return v:shell_error ? '' : out endfunction +function! s:Remote(dir) abort + let head = FugitiveHead(0, a:dir) + let remote = len(head) ? fugitive#Config('branch.' . head . '.remote') : '' + let i = 10 + while remote ==# '.' && i > 0 + let head = matchstr(fugitive#Config('branch.' . head . '.merge'), 'refs/heads/\zs.*') + let remote = len(head) ? fugitive#Config('branch.' . head . '.remote') : '' + let i -= 1 + endwhile + return remote =~# '\.\=$' ? 'origin' : remote +endfunction + function! fugitive#RemoteUrl(...) abort let dir = a:0 > 1 ? a:2 : get(b:, 'git_dir', '') - let remote = !a:0 || a:1 =~# '^\.\=$' ? 'origin' : a:1 + let remote = !a:0 || a:1 =~# '^\.\=$' ? s:Remote(dir) : a:1 if fugitive#GitVersion() =~# '^[01]\.\|^2\.[0-6]\.' return fugitive#Config('remote.' . remote . '.url') endif