Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH 5/5] _git: Complete fetchy refspecs correctly.
Date: Sat, 30 Apr 2016 00:48:19 +0000
Message-Id: <1461977299-3770-6-git-send-email-danielsh@tarsus.local2>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <1461977299-3770-1-git-send-email-danielsh@tarsus.local2>
References: <1461977299-3770-1-git-send-email-danielsh@tarsus.local2>
X-Seq: zsh-workers 38369

---
 Completion/Unix/Command/_git | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index f0cc185..90789de 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5369,8 +5369,19 @@ __git_ref_specs_pushy () {
 
 (( $+functions[__git_ref_specs_fetchy] )) ||
 __git_ref_specs_fetchy () {
-  # TODO: this is wrong
-  __git_ref_specs_pushy "$@"
+  # TODO: This needs to deal with a lot more types of things.
+  if compset -P '*:'; then
+    __git_heads_local
+  else
+    compset -P '+'
+    if compset -S ':*'; then
+      # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only
+      __git_remote_branch_names_noprefix
+    else
+      # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only
+      __git_remote_branch_names_noprefix -qS :
+    fi
+  fi
 }
 
 (( $+functions[__git_ref_specs] )) ||

