commit c3e918072f5f535cbbcf7eba4227c2ab77adf8c4 (tree)
parent d854197c03c0b027cca41abf86a5557c5473b82f
Author: Tim Pope <code@tpope.net>
Date: Tue, 1 Dec 2015 18:06:38 -0500
Accommodate @ as alias for HEAD
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -320,6 +320,8 @@ function! s:repo_translate(spec) dict abort
return 'fugitive://'.self.dir().'//'.ref
elseif a:spec =~# '^:'
return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1]
+ elseif a:spec ==# '@'
+ return self.dir('HEAD')
elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(self.dir(a:spec))
return self.dir(a:spec)
elseif filereadable(self.dir('refs/'.a:spec))
@@ -2175,7 +2177,7 @@ call s:command("-bar -bang -range -nargs=* -complete=customlist,s:EditComplete G
function! s:Browse(bang,line1,count,...) abort
try
- let rev = a:0 ? substitute(join(a:000, ' '),'@[[:alnum:]_-]*\%(://.\{-\}\)\=$','','') : ''
+ let rev = a:0 ? substitute(join(a:000, ' '),'@[[:alnum:]_-]\w\+\%(://.\{-\}\)\=$','','') : ''
if rev ==# ''
let expanded = s:buffer().rev()
elseif rev ==# ':'
@@ -2218,7 +2220,7 @@ function! s:Browse(bang,line1,count,...) abort
endif
endif
- if a:0 && join(a:000, ' ') =~# '@[[:alnum:]_-]*\%(://.\{-\}\)\=$'
+ if a:0 && join(a:000, ' ') =~# '@[[:alnum:]_-]\+\%(://.\{-\}\)\=$'
let remote = matchstr(join(a:000, ' '),'@\zs[[:alnum:]_-]\+\%(://.\{-\}\)\=$')
elseif path =~# '^\.git/refs/remotes/.'
let remote = matchstr(path,'^\.git/refs/remotes/\zs[^/]\+')