diff options
author | James McCoy <jamessan@jamessan.com> | 2021-12-20 14:28:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 14:28:11 -0500 |
commit | 9241c684e18d85205b1a6e4e4a33b187b78a7356 (patch) | |
tree | 5e4364934c842a3cae555e29f5e50db2be85b9ec /src/nvim/ex_docmd.c | |
parent | 9625832372e77c8a15f6ebb30df4fcbb6aba6fe8 (diff) | |
parent | 09c412837fc9690ac8817dfd9c623dc6771c8d25 (diff) | |
download | rneovim-9241c684e18d85205b1a6e4e4a33b187b78a7356.tar.gz rneovim-9241c684e18d85205b1a6e4e4a33b187b78a7356.tar.bz2 rneovim-9241c684e18d85205b1a6e4e4a33b187b78a7356.zip |
Merge pull request #16734 from zeertzjq/chdir-refactor
refactor: remove some chdir-related unnecessary calls and checks
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 9f0f8d93a3..ee7946fe3e 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7816,8 +7816,9 @@ bool changedir_func(char_u *new_dir, CdScope scope) } #endif - if (vim_chdir(new_dir) == 0) { - bool dir_differs = pdir == NULL || pathcmp((char *)pdir, (char *)new_dir, -1) != 0; + bool dir_differs = new_dir == NULL || pdir == NULL + || pathcmp((char *)pdir, (char *)new_dir, -1) != 0; + if (new_dir != NULL && (!dir_differs || vim_chdir(new_dir) == 0)) { post_chdir(scope, dir_differs); retval = true; } else { |