From d148915bd302a81ec5870e042c410d80fa03bc66 Mon Sep 17 00:00:00 2001
From: Jerome Reybert <jreybert@gmail.com>
Date: Fri, 30 Oct 2015 23:47:56 +0100
Subject: [PATCH] autoload/magit/git.vim: add git_checkout(), fix git_add() and
 git_reset()

---
 autoload/magit/git.vim | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/autoload/magit/git.vim b/autoload/magit/git.vim
index 0d4e55e..66b0181 100644
--- a/autoload/magit/git.vim
+++ b/autoload/magit/git.vim
@@ -59,7 +59,20 @@ endfunction
 " message is raised.
 " param[in] filemane: it must be quoted if it contains spaces
 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)
 	if ( v:shell_error != 0 )
 		echoerr "Git error: " . git_result
@@ -72,7 +85,7 @@ endfunction
 " message is raised.
 " param[in] filemane: it must be quoted if it contains spaces
 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)
 	if ( v:shell_error != 0 )
 		echoerr "Git error: " . git_result
-- 
GitLab