diff options
-rw-r--r-- | src/nvim/diff.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_diffmode.vim | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index dd489c18e9..4db81a97a2 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -925,7 +925,7 @@ void ex_diffpatch(exarg_T *eap) } else { // Build the patch command and execute it. Ignore errors. #ifdef UNIX - vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"", + vim_snprintf((char *)buf, buflen, "patch -o %s %s < '%s'", tmp_new, tmp_orig, fullname != NULL ? fullname : eap->arg); #else vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"", diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index b5a76909a2..430d02c2c3 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -501,9 +501,20 @@ func Test_diffpatch() bwipe! new call assert_fails('diffpatch Xpatch', 'E816:') - call setline(1, ['1', '2', '3']) - diffpatch Xpatch - call assert_equal(['1', '2x', '3', '4'], getline(1, '$')) + + for name in ['Xpatch', 'Xpatch$HOME'] + call setline(1, ['1', '2', '3']) + if name != 'Xpatch' + call rename('Xpatch', name) + endif + exe 'diffpatch ' . escape(name, '$') + call assert_equal(['1', '2x', '3', '4'], getline(1, '$')) + if name != 'Xpatch' + call rename(name, 'Xpatch') + endif + bwipe! + endfor + call delete('Xpatch') bwipe! endfunc |