summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/os_unix.c10
-rw-r--r--src/testdir/test_cd.vim17
-rw-r--r--src/version.c2
3 files changed, 28 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index a3e5430ef9..d192b6bcfa 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2647,7 +2647,15 @@ mch_FullName(
{
vim_strncpy(buf, fname, p - fname);
if (mch_chdir((char *)buf))
- retval = FAIL;
+ {
+ // Path does not exist (yet). For a full path fail,
+ // will use the path as-is. For a relative path use
+ // the current directory and append the file name.
+ if (mch_isFullName(fname))
+ retval = FAIL;
+ else
+ p = NULL;
+ }
else if (*p == '/')
fname = p + 1;
else
diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim
index 8eda44aff2..bcca2f8e7c 100644
--- a/src/testdir/test_cd.vim
+++ b/src/testdir/test_cd.vim
@@ -208,4 +208,21 @@ func Test_cd_completion()
call delete('XComplFile')
endfunc
+func Test_cd_unknown_dir()
+ call mkdir('Xa')
+ cd Xa
+ call writefile(['text'], 'Xb.txt')
+ edit Xa/Xb.txt
+ let first_buf = bufnr()
+ cd ..
+ edit
+ call assert_equal(first_buf, bufnr())
+ edit Xa/Xb.txt
+ call assert_notequal(first_buf, bufnr())
+
+ bwipe!
+ exe "bwipe! " .. first_buf
+ call delete('Xa', 'rf')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 410776742f..00ede81abe 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3468,
+/**/
3467,
/**/
3466,