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

autoload/magit/git.vim: add git_checkout(), fix git_add() and git_reset()

parent d7581754
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,20 @@ endfunction ...@@ -59,7 +59,20 @@ endfunction
" message is raised. " message is raised.
" param[in] filemane: it must be quoted if it contains spaces " param[in] filemane: it must be quoted if it contains spaces
function! magit#git#git_add(filename) function! magit#git#git_add(filename)
let git_cmd=s:git_cmd . " add -- " . a:filename let git_cmd=s:git_cmd . " add --no-ignore-removal -- " . a:filename
silent let git_result=magit#utils#system(git_cmd)
if ( v:shell_error != 0 )
echoerr "Git error: " . git_result
echoerr "Git cmd: " . git_cmd
endif
endfunction
" magit#git#git_checkout: helper function to add a whole file
" nota: when git fail (due to misformated patch for example), an error
" message is raised.
" param[in] filemane: it must be quoted if it contains spaces
function! magit#git#git_checkout(filename)
let git_cmd=s:git_cmd . " checkout -- " . a:filename
silent let git_result=magit#utils#system(git_cmd) silent let git_result=magit#utils#system(git_cmd)
if ( v:shell_error != 0 ) if ( v:shell_error != 0 )
echoerr "Git error: " . git_result echoerr "Git error: " . git_result
...@@ -72,7 +85,7 @@ endfunction ...@@ -72,7 +85,7 @@ endfunction
" message is raised. " message is raised.
" param[in] filemane: it must be quoted if it contains spaces " param[in] filemane: it must be quoted if it contains spaces
function! magit#git#git_reset(filename) function! magit#git#git_reset(filename)
let git_cmd=s:git_cmd . " reset -- " . a:filename let git_cmd=s:git_cmd . " reset HEAD -- " . a:filename
silent let git_result=magit#utils#system(git_cmd) silent let git_result=magit#utils#system(git_cmd)
if ( v:shell_error != 0 ) if ( v:shell_error != 0 )
echoerr "Git error: " . git_result echoerr "Git error: " . git_result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment