mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2026-10-15 02:31:22 +08:00
Experiment: Always use SHA in :Gbrowse
I've been holding out on this forever because links to the latest are occasionally useful, but more often than not, a permanent link to the file as it currently stands is most useful. At any rate, it shouldn't be Rhubarb's job to parse out the branch name.
This commit is contained in:
1 parent
c6c6f4bbf3
commit
5e4f174d82
1 file changed
+3
-9
@@ -184,7 +184,7 @@ endfunction
|
||||
" Section: Fugitive :Gbrowse support
|
||||
|
||||
function! rhubarb#fugitive_url(opts, ...) abort
|
||||
if a:0 || type(a:opts) != type({}) || !has_key(a:opts, 'repo') || !has_key(a:opts, 'revision')
|
||||
if a:0 || type(a:opts) != type({}) || !has_key(a:opts, 'repo')
|
||||
return ''
|
||||
endif
|
||||
let root = rhubarb#homepage_for_url(get(a:opts, 'remote'))
|
||||
@@ -208,14 +208,8 @@ function! rhubarb#fugitive_url(opts, ...) abort
|
||||
elseif path =~# '^\.git\>'
|
||||
return root
|
||||
endif
|
||||
if a:opts.revision =~# '^[[:alnum:]._-]\+:'
|
||||
let commit = matchstr(a:opts.revision,'^[^:]*')
|
||||
elseif a:opts.commit =~# '^\d\=$'
|
||||
let local = matchstr(a:opts.repo.head_ref(),'\<refs/heads/\zs.*')
|
||||
let commit = a:opts.repo.git_chomp('config','branch.'.local.'.merge')[11:-1]
|
||||
if commit ==# ''
|
||||
let commit = local
|
||||
endif
|
||||
if a:opts.commit =~# '^\d\=$'
|
||||
let commit = a:opts.repo.rev_parse('HEAD')
|
||||
else
|
||||
let commit = a:opts.commit
|
||||
endif
|
||||
|
||||
Reference in new issue
Block a user