Favor ssh:// URL over scp style when possible

This is much easier to deal with on other end, so if a :GBrowse provider
doesn't care about relative scp paths, allow them to ditch the scp
parsing entirely.
This commit is contained in:
Tim Pope
2021-08-29 09:54:23 -04:00
parent a6be4a301c
commit 6f0ff0ed00

View File

@@ -1175,10 +1175,12 @@ function! fugitive#ResolveRemote(remote) abort
if len(scp_authority) && !(has('win32') && scp_authority =~# '^\a:[\/]')
let path = strpart(a:remote, len(scp_authority) + 1)
let authority = fugitive#SshHostAlias(scp_authority)
if authority !~# ':'
return authority . ':' . path
elseif path =~# '^/'
if path =~# '^/'
return 'ssh://' . authority . path
elseif path =~# '^\~'
return 'ssh://' . authority . '/' . path
elseif authority !~# ':'
return authority . ':' . path
endif
elseif a:remote =~# '^https\=://' && s:executable('curl')
if !has_key(s:redirects, a:remote)