summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglacambre <code@lacamb.re>2021-05-24 14:20:53 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-24 14:20:53 +0200
commitad5c178a191cf2cf37a27c2a789d7afda3879831 (patch)
tree6ad25f075155d0a6b88064d749f87c763679b382
parentf5409dbf66f4e4a0461d3f2079c1bffacbf12392 (diff)
downloadvim-git-ad5c178a191cf2cf37a27c2a789d7afda3879831.tar.gz
patch 8.2.2880: unified diff fails if actually usedv8.2.2880
Problem: Unified diff fails if actually used. Solution: Invoke :diffupdate in the test. Fix the check for working external diff. (Ghjuvan Lacambre, Christian Brabandt, closes #8197)
-rw-r--r--src/diff.c6
-rw-r--r--src/testdir/test_diffmode.vim5
-rw-r--r--src/version.c2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/diff.c b/src/diff.c
index 0a0594cfe..6f25c373c 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1007,10 +1007,12 @@ check_external_diff(diffio_T *diffio)
for (;;)
{
- // There must be a line that contains "1c1".
+ // For normal diff there must be a line that contains
+ // "1c1". For unified diff "@@ -1 +1 @@".
if (vim_fgets(linebuf, LBUFLEN, fd))
break;
- if (STRNCMP(linebuf, "1c1", 3) == 0)
+ if (STRNCMP(linebuf, "1c1", 3) == 0
+ || STRNCMP(linebuf, "@@ -1 +1 @@", 11) == 0)
ok = TRUE;
}
fclose(fd);
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index 4696456a2..96a8d2c06 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -796,6 +796,7 @@ func VerifyBoth(buf, dumpfile, extra)
" also test unified diff
call term_sendkeys(a:buf, ":call SetupUnified()\<CR>:")
+ call term_sendkeys(a:buf, ":redraw!\<CR>:")
call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified')
call term_sendkeys(a:buf, ":call StopUnified()\<CR>:")
endfunc
@@ -817,10 +818,11 @@ func Test_diff_screen()
func UnifiedDiffExpr()
" Prepend some text to check diff type detection
call writefile(['warning', ' message'], v:fname_out)
- silent exe '!diff -u ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out
+ silent exe '!diff -U0 ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out
endfunc
func SetupUnified()
set diffexpr=UnifiedDiffExpr()
+ diffupdate
endfunc
func StopUnified()
set diffexpr=
@@ -1218,4 +1220,5 @@ func Test_diff_filler_cursorcolumn()
call delete('Xtest_diff_cuc')
endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 796899be3..1c4bbfada 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2880,
+/**/
2879,
/**/
2878,