commit 9e05d7ee03f6abf4f1700b047cf5a471d16225cd (tree)
parent 55fac5dd746121771c093756ee569d949867465c
Author: Tim Pope <code@tpope.net>
Date: Thu, 24 Feb 2011 15:51:51 -0500
Allow :Gbrowse @git://...
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -1374,9 +1374,9 @@ call s:command("-bar -bang -count=0 -nargs=? Gbrowse :execute s:Browse(<bang>0,<
function! s:Browse(bang,line1,count,...) abort
try
- let rev = a:0 ? substitute(a:1,'@[[:alnum:]_-]\+$','','') : ''
- if a:0 && a:1 =~# '@[[:alnum:]_-]\+$'
- let remote = matchstr(a:1,'@\zs[[:alnum:]_-]\+$')
+ let rev = a:0 ? substitute(a:1,'@[[:alnum:]_-]\+\%(://.\{-\}\)\=$','','') : ''
+ if a:0 && a:1 =~# '@[[:alnum:]_-]\+\%(://.\{-\}\)\=$'
+ let remote = matchstr(a:1,'@\zs[[:alnum:]_-]\+\%(://.\{-\}\)\=$')
elseif s:buffer().path() =~# '^\.git/refs/remotes/.'
let remote = matchstr(s:buffer().path(),'^\.git/refs/remotes/\zs[^/]\+')
else
@@ -1390,6 +1390,9 @@ function! s:Browse(bang,line1,count,...) abort
endif
endif
let raw = s:repo().git_chomp('config','remote.'.remote.'.url')
+ if raw ==# ''
+ let raw = remote
+ endif
let url = s:github_url(s:buffer(),raw,rev,a:line1,a:count)
if url == ''
let url = s:instaweb_url(s:buffer(),rev,a:count ? a:line1 : 0)