]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0375: cannot use diff mode with Cygwin diff.exe v8.1.0375
authorBram Moolenaar <Bram@vim.org>
Thu, 13 Sep 2018 11:03:11 +0000 (13:03 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 13 Sep 2018 11:03:11 +0000 (13:03 +0200)
Problem:    Cannot use diff mode with Cygwin diff.exe. (Igor Forca)
Solution:   Skip over unrecognized lines in the diff output.

src/diff.c
src/testdir/test_diffmode.vim
src/version.c

index 0055cba5ac8dbc91dc5130536dc49e948e7f45c8..59daf1eeb03a665d5a80154b5ca7cd2ff0ede50c 100644 (file)
@@ -1600,6 +1600,10 @@ diff_read(
                    && (tag_fgets(linebuf, LBUFLEN, fd) == 0)
                    && (STRNCMP(line, "@@ ", 3) == 0))
                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)
index c3c1eaf4a55a5a336d162ff4ab2753740d71a1e7..0022a73b3ff91cdfacb79d9cfe67b189badd0962 100644 (file)
@@ -519,7 +519,9 @@ func Test_diffexpr()
   endif
 
   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
   set diffexpr=DiffExpr()
   set diffopt=foldcolumn:0
index ca6ac59f06c19b376fffee42949e76accb93b3f8..c1033391266c57479f2c5c5a6c87c3622f55ebb0 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    375,
 /**/
     374,
 /**/