about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorØystein Walle <oystwa@gmail.com>2023-02-10 08:23:01 +0100
committerOliver Kiddle <opk@zsh.org>2023-02-17 23:35:39 +0100
commit619cf4fbd5843b3b6cb94be3ce5a2953bfc29dc5 (patch)
tree686b76d9a7f993c888cc22f3a81bd6736a2a7641 /Completion
parent32cceefa95903190829af26723b7ad51c163040c (diff)
downloadzsh-619cf4fbd5843b3b6cb94be3ce5a2953bfc29dc5.tar.gz
zsh-619cf4fbd5843b3b6cb94be3ce5a2953bfc29dc5.tar.xz
zsh-619cf4fbd5843b3b6cb94be3ce5a2953bfc29dc5.zip
51391: complete remote branch names respecting --delete for git push
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_git10
1 files changed, 9 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index b3ed7b5c8..a2555cbf0 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1459,6 +1459,14 @@ _git-push () {
   # only complete files on the local end, not the remote end.  Still, it may be
   # helpful to get some sort of completion going, perhaps modifying the path
   # later on to match the remote end.
+
+  local ref_arg
+  if (( words[(I)-d|--delete] )); then
+      ref_arg='*: :__git_remote_branch_names_noprefix'
+  else
+      ref_arg='*: :__git_ref_specs_pushy'
+  fi
+
   _arguments -S -s $endopt \
     '--all[push all refs under refs/heads/]' \
     '--prune[remove remote branches that do not have a local counterpart]' \
@@ -1494,7 +1502,7 @@ _git-push () {
     '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
     '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
     ': :__git_any_repositories' \
-    '*: :__git_ref_specs_pushy' && ret=0
+    $ref_arg && ret=0
 
   case $state in
     (lease)