From 9acbad1335ee6f30a8497733dcb2373c4550c8a2 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 25 Mar 2023 04:58:18 -0400 Subject: [PATCH] Try harder to match diff headers with ambiguous spacing Resolves: https://github.com/tpope/vim-fugitive/issues/2135 --- autoload/fugitive.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 572484a..9f14a4b 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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