mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-07 04:34:27 +08:00
Future proofing
This commit is contained in:
@@ -191,7 +191,7 @@ function! rhubarb#fugitive_url(opts, ...) abort
|
|||||||
if empty(root)
|
if empty(root)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
let path = a:opts.path
|
let path = substitute(a:opts.path, '^/', '', '')
|
||||||
if path =~# '^\.git/refs/heads/'
|
if path =~# '^\.git/refs/heads/'
|
||||||
let branch = a:opts.repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1]
|
let branch = a:opts.repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1]
|
||||||
if branch ==# ''
|
if branch ==# ''
|
||||||
@@ -219,7 +219,7 @@ function! rhubarb#fugitive_url(opts, ...) abort
|
|||||||
else
|
else
|
||||||
let commit = a:opts.commit
|
let commit = a:opts.commit
|
||||||
endif
|
endif
|
||||||
if a:opts.type == 'tree'
|
if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
|
||||||
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
|
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
|
||||||
elseif a:opts.type == 'blob'
|
elseif a:opts.type == 'blob'
|
||||||
let url = root . '/blob/' . commit . '/' . path
|
let url = root . '/blob/' . commit . '/' . path
|
||||||
|
|||||||
Reference in New Issue
Block a user