From 6f0ff0ed009f6eb915cd5b012ee6011f8c568e5c Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 29 Aug 2021 09:54:23 -0400 Subject: [PATCH] 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. --- autoload/fugitive.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 532c42c..79c01b6 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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)