Try harder to match diff headers with ambiguous spacing

Resolves: https://github.com/tpope/vim-fugitive/issues/2135
This commit is contained in:
Tim Pope
2023-03-25 04:58:18 -04:00
parent 309c68117e
commit 9acbad1335

View File

@@ -7639,7 +7639,10 @@ function! s:NavigateUp(count) abort
endfunction
function! s:ParseDiffHeader(str) abort
let list = matchlist(a:str, '\Cdiff --git \("\=[^/].*\|/dev/null\) \("\=[^/].*\|/dev/null\)$')
let list = matchlist(a:str, '\Cdiff --git \("\=\w/.*\|/dev/null\) \("\=\w/.*\|/dev/null\)$')
if empty(list)
let list = matchlist(a:str, '\Cdiff --git \("\=[^/].*\|/dev/null\) \("\=[^/].*\|/dev/null\)$')
endif
return [fugitive#Unquote(get(list, 1, '')), fugitive#Unquote(get(list, 2, ''))]
endfunction