From 9af6de1668aeabfcd1c82f114aad74132d21a8c0 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 26 Jun 2022 15:22:18 -0400 Subject: [PATCH] Use fugitive:///c:/ instead of fugitive://c:/ on win32 This avoids a bogus use of the host field in a standard URL and matches how file:// URLs work. --- autoload/fugitive.vim | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index c1525e9..7116459 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -137,7 +137,7 @@ endfunction if exists('+shellslash') - let s:dir_commit_file = '\c^fugitive://\%(/\a\@=\)\=\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$' + let s:dir_commit_file = '\c^fugitive://\%(/[^/]\@=\)\=\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$' function! s:Slash(path) abort return tr(a:path, '\', '/') @@ -542,9 +542,16 @@ function! s:SameRepo(one, two) abort return !empty(one) && one ==# s:GitDir(a:two) endfunction -function! s:DirUrlPrefix(...) abort - return 'fugitive://' . call('s:GitDir', a:000) . '//' -endfunction +if exists('+shellslash') + function! s:DirUrlPrefix(...) abort + let gd = call('s:GitDir', a:000) + return 'fugitive://' . (gd =~# '^[^/]' ? '/' : '') . gd . '//' + endfunction +else + function! s:DirUrlPrefix(...) abort + return 'fugitive://' . call('s:GitDir', a:000) . '//' + endfunction +endif function! s:Tree(...) abort return a:0 ? FugitiveWorkTree(a:1) : FugitiveWorkTree()