mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-07 04:34:27 +08:00
Abstract check for .git/refs/ path
This commit is contained in:
@@ -307,13 +307,14 @@ function! rhubarb#FugitiveUrl(...) abort
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
let path = substitute(opts.path, '^/', '', '')
|
let path = substitute(opts.path, '^/', '', '')
|
||||||
if path =~# '^\.git/refs/heads/'
|
let ref = matchstr(opts.path, '^/\=\.git/\zsrefs/.*')
|
||||||
return root . '/commits/' . path[16:-1]
|
if ref =~# '^refs/heads/'
|
||||||
elseif path =~# '^\.git/refs/tags/'
|
return root . '/commits/' . ref[11:-1]
|
||||||
return root . '/releases/tag/' . path[15:-1]
|
elseif ref =~# '^refs/tags/'
|
||||||
elseif path =~# '^\.git/refs/remotes/[^/]\+/.'
|
return root . '/releases/tag/' . ref[10:-1]
|
||||||
return root . '/commits/' . matchstr(path,'remotes/[^/]\+/\zs.*')
|
elseif ref =~# '^refs/remotes/[^/]\+/.'
|
||||||
elseif path =~# '^\.git\>'
|
return root . '/commits/' . matchstr(ref,'remotes/[^/]\+/\zs.*')
|
||||||
|
elseif opts.path =~# '^/\=\.git\>'
|
||||||
return root
|
return root
|
||||||
endif
|
endif
|
||||||
let commit = opts.commit
|
let commit = opts.commit
|
||||||
|
|||||||
Reference in New Issue
Block a user