1
0
forked from aniani/vim

patch 8.1.0375: cannot use diff mode with Cygwin diff.exe

Problem:    Cannot use diff mode with Cygwin diff.exe. (Igor Forca)
Solution:   Skip over unrecognized lines in the diff output.
This commit is contained in:
Bram Moolenaar
2018-09-13 13:03:11 +02:00
parent bd9a53c06c
commit 3b8defd0a5
3 changed files with 9 additions and 1 deletions

View File

@@ -1600,6 +1600,10 @@ diff_read(
&& (tag_fgets(linebuf, LBUFLEN, fd) == 0) && (tag_fgets(linebuf, LBUFLEN, fd) == 0)
&& (STRNCMP(line, "@@ ", 3) == 0)) && (STRNCMP(line, "@@ ", 3) == 0))
diffstyle = DIFF_UNIFIED; diffstyle = DIFF_UNIFIED;
else
// Format not recognized yet, skip over this line. Cygwin diff
// may put a warning at the start of the file.
continue;
} }
if (diffstyle == DIFF_ED) if (diffstyle == DIFF_ED)

View File

@@ -519,7 +519,9 @@ func Test_diffexpr()
endif endif
func DiffExpr() func DiffExpr()
silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>' . v:fname_out " Prepent some text to check diff type detection
call writefile(['warning', ' message'], v:fname_out)
silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out
endfunc endfunc
set diffexpr=DiffExpr() set diffexpr=DiffExpr()
set diffopt=foldcolumn:0 set diffopt=foldcolumn:0

View File

@@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
375,
/**/ /**/
374, 374,
/**/ /**/