Skip to content
Snippets Groups Projects
Commit 3cea54ac authored by Jerome Reybert's avatar Jerome Reybert
Browse files

autoload/magit/utils.vim,plugin/magit.vim: escape dirs while chdir (fix #89)

parent d1c75449
Branches
Tags
No related merge requests found
...@@ -25,7 +25,7 @@ endfunction ...@@ -25,7 +25,7 @@ endfunction
let s:magit_cd_cmd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let s:magit_cd_cmd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
" magit#utils#lcd: helper function to lcd. use cd if lcd doesn't exists " magit#utils#lcd: helper function to lcd. use cd if lcd doesn't exists
function! magit#utils#lcd(dir) function! magit#utils#lcd(dir)
execute s:magit_cd_cmd . a:dir execute s:magit_cd_cmd . fnameescape(a:dir)
endfunction endfunction
" magit#utils#clear_undo: this function clear local undo history. " magit#utils#clear_undo: this function clear local undo history.
...@@ -55,7 +55,7 @@ endfunction ...@@ -55,7 +55,7 @@ endfunction
function! magit#utils#system(...) function! magit#utils#system(...)
let dir = getcwd() let dir = getcwd()
try 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 " List as system() input is since v7.4.247, it is safe to check
" systemlist, which is sine v7.4.248 " systemlist, which is sine v7.4.248
if exists('*systemlist') if exists('*systemlist')
...@@ -75,7 +75,7 @@ function! magit#utils#system(...) ...@@ -75,7 +75,7 @@ function! magit#utils#system(...)
endif endif
endif endif
finally finally
execute s:magit_cd_cmd . dir call magit#utils#lcd(dir)
endtry endtry
endfunction endfunction
...@@ -88,7 +88,7 @@ endfunction ...@@ -88,7 +88,7 @@ endfunction
function! magit#utils#systemlist(...) function! magit#utils#systemlist(...)
let dir = getcwd() let dir = getcwd()
try try
execute s:magit_cd_cmd . magit#git#top_dir() call magit#utils#lcd(magit#git#top_dir())
" systemlist since v7.4.248 " systemlist since v7.4.248
if exists('*systemlist') if exists('*systemlist')
return call('systemlist', a:000) return call('systemlist', a:000)
...@@ -96,7 +96,7 @@ function! magit#utils#systemlist(...) ...@@ -96,7 +96,7 @@ function! magit#utils#systemlist(...)
return split(call('magit#utils#system', a:000), '\n') return split(call('magit#utils#system', a:000), '\n')
endif endif
finally finally
execute s:magit_cd_cmd . dir call magit#utils#lcd(dir)
endtry endtry
endfunction endfunction
......
...@@ -778,7 +778,7 @@ function! magit#show_magit(display, ...) ...@@ -778,7 +778,7 @@ function! magit#show_magit(display, ...)
throw 'magit_not_in_git_repo' throw 'magit_not_in_git_repo'
endif 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) let magit_win = magit#utils#search_buffer_in_windows(buffer_name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment