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

[PATCH 3/4] Fix git-branch -[dD] -r completion



Signed-off-by: Nikolai Weibull <now@xxxxxxxx>
---
 Completion/Unix/Command/_git |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 8a590be..0f573a1 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -266,8 +266,12 @@ _git-branch () {
   if (( words[(I)-d] || words[(I)-D] )); then
     dependent_creation_args=
     dependent_deletion_args=(
-      '-r[delete remote-tracking branches]'
-      '*: :__git_ignore_line_inside_arguments __git_branch_names')
+      '-r[delete remote-tracking branches]')
+    if (( words[(I)-r] )); then
+      dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names'
+    else
+      dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names'
+    fi
   fi
 
   declare -a dependent_modification_args
@@ -4913,7 +4917,7 @@ __git_remote_branch_names () {
   local expl
   declare -a branch_names
 
-  branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='%(refname)' refs/remotes 2>/dev/null)"}#refs/remotes/})
+  branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/})
   __git_command_successful $pipestatus || return
 
   _wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names
-- 
1.7.4.1



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