Skip to content

Commit

Permalink
autoload/magit/utils.vim,plugin/magit.vim: escape dirs while chdir (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jreybert committed Oct 19, 2016
1 parent d1c7544 commit 3cea54a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions autoload/magit/utils.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endfunction
let s:magit_cd_cmd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
" magit#utils#lcd: helper function to lcd. use cd if lcd doesn't exists
function! magit#utils#lcd(dir)
execute s:magit_cd_cmd . a:dir
execute s:magit_cd_cmd . fnameescape(a:dir)
endfunction

" magit#utils#clear_undo: this function clear local undo history.
Expand Down Expand Up @@ -55,7 +55,7 @@ endfunction
function! magit#utils#system(...)
let dir = getcwd()
try
execute s:magit_cd_cmd . magit#git#top_dir()
call magit#utils#lcd(magit#git#top_dir())
" List as system() input is since v7.4.247, it is safe to check
" systemlist, which is sine v7.4.248
if exists('*systemlist')
Expand All @@ -75,7 +75,7 @@ function! magit#utils#system(...)
endif
endif
finally
execute s:magit_cd_cmd . dir
call magit#utils#lcd(dir)
endtry
endfunction

Expand All @@ -88,15 +88,15 @@ endfunction
function! magit#utils#systemlist(...)
let dir = getcwd()
try
execute s:magit_cd_cmd . magit#git#top_dir()
call magit#utils#lcd(magit#git#top_dir())
" systemlist since v7.4.248
if exists('*systemlist')
return call('systemlist', a:000)
else
return split(call('magit#utils#system', a:000), '\n')
endif
finally
execute s:magit_cd_cmd . dir
call magit#utils#lcd(dir)
endtry
endfunction

Expand Down
2 changes: 1 addition & 1 deletion plugin/magit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ function! magit#show_magit(display, ...)
throw 'magit_not_in_git_repo'
endif

let buffer_name='magit://' . git_dir
let buffer_name=fnameescape('magit://' . git_dir)

let magit_win = magit#utils#search_buffer_in_windows(buffer_name)

Expand Down

0 comments on commit 3cea54a

Please sign in to comment.