summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-04-29 09:10:18 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-05-01 01:52:29 +0000
commit276a690a2ea7f9a4cf20748c955eea4dbe2f2d02 (patch)
tree8cc6d084c259feebc17019b52a4196366a6d157b
parentfe21e49a6d97c0dbbb6694da00f132b8416e4b99 (diff)
downloadzsh-276a690a2ea7f9a4cf20748c955eea4dbe2f2d02.tar.gz
zsh-276a690a2ea7f9a4cf20748c955eea4dbe2f2d02.tar.xz
zsh-276a690a2ea7f9a4cf20748c955eea4dbe2f2d02.zip
_git: Complete fetchy refspecs correctly.
-rw-r--r--Completion/Unix/Command/_git15
1 files changed, 13 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 37ac3e0fd..d3002075f 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] )) ||