Skip to content

Commit

Permalink
Don't change dir if dir is the same
Browse files Browse the repository at this point in the history
  • Loading branch information
hkupty committed Oct 5, 2016
1 parent 6e8dae2 commit f111332
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions autoload/magit/utils.vim
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ endfunction
" prior to changing the cwd.
function! magit#utils#pushd_root()
if has('nvim')
let g:_vimagit_cwd = haslocaldir(-1, 0) ? getcwd(-1, 0) : getcwd()
let cwd = haslocaldir(-1, 0) ? getcwd(-1, 0) : getcwd()
else
let g:_vimagit_cwd = getcwd()
let cwd = getcwd()
endif

let root = magit#git#top_dir()

if root !=? cwd
call magit#utils#chdir(root)
let g:_vimagit_cwd = cwd
endif
call magit#utils#chdir(magit#git#top_dir())
endfunction


Expand Down

0 comments on commit f111332

Please sign in to comment.