Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 15/16] _git: git rm: make git rm --cached work as intended



From: m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>

While limiting the completion to __git_changed-in-index_files
makes perfect sense for "git diff", it is wrong to use for
"git rm", because it prevents it from completing files present in
HEAD. Giving --cached to git rm is supposed to
"just remove it from the index, keep the working tree copy"
and is in no way related to the file needing to be
modified in the index in the first place.
---
 Completion/Unix/Command/_git | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 9b15d57..9f133f9 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1342,11 +1342,7 @@ _git-rm () {
 
   case $state in
     (file)
-      if [[ -n ${opt_args[(I)--cached]} ]]; then
-        __git_changed-in-index_files && ret=0
-      else
-        __git_cached_files && ret=0
-      fi
+      __git_cached_files && ret=0
       ;;
   esac
 
-- 
1.8.2.2



Messages sorted by: Reverse Date, Date, Thread, Author