Accept both fugitive://C:/ and fugitive:///C:/ on win32

The 2 slash version slots the drive letter into the host field, which
I'm worried will cause problems when the URLs are used non-opaquely, for
example, with an LSP.  Let's start transitioning to the convention used
by file:// URLs.
This commit is contained in:
Tim Pope
2022-05-27 19:56:43 -04:00
parent a504abb8b8
commit 5ec0793b88
2 changed files with 10 additions and 6 deletions

View File

@@ -139,10 +139,12 @@ function! s:Mods(mods, ...) abort
endfunction
if exists('+shellslash')
let s:dir_commit_file = '\c^fugitive://\%(/\a\@=\)\=\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$'
function! s:Slash(path) abort
return tr(a:path, '\', '/')
endfunction
else
let s:dir_commit_file = '\c^fugitive://\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$'
function! s:Slash(path) abort
return a:path
endfunction
@@ -1606,7 +1608,7 @@ call s:add_methods('repo',['config', 'user'])
" Section: File API
function! s:DirCommitFile(path) abort
let vals = matchlist(s:Slash(a:path), '\c^fugitive://\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$')
let vals = matchlist(s:Slash(a:path), s:dir_commit_file)
if empty(vals)
return ['', '', '']
endif