summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2017-08-16 23:40:57 +0200
committerOliver Kiddle <opk@zsh.org>2017-08-16 23:41:09 +0200
commitf80fe2dfe9dffc512fe76931879087a3ed6d6fa8 (patch)
tree6a7536b540841a5ae97518e14d3617d73768fe25
parentddb86759012992fa6471bd738f906a4ed434b69f (diff)
downloadzsh-f80fe2dfe9dffc512fe76931879087a3ed6d6fa8.tar.gz
zsh-f80fe2dfe9dffc512fe76931879087a3ed6d6fa8.tar.xz
zsh-f80fe2dfe9dffc512fe76931879087a3ed6d6fa8.zip
41552: complete only branches after git worktree add --detach
the --detach is superfluous for other commits
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_git4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a9be8cc7..fa07bbf4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-16  Oliver Kiddle  <opk@zsh.org>
+
+	* 41552: Completion/Unix/Command/_git: complete only branches
+	after git worktree add --detach because the --detach is
+	superfluous for other commits
+
 2017-08-15  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* posted twice but has not shown up: Src/exec.c, Src/zsh.h:
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 518e6d198..26554de05 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -2027,9 +2027,9 @@ _git-worktree() {
       case $line[1] in
         (add)
 	  if (( $words[(I)--detach] )); then
-	    args=( ':commit:__git_commits' )
-	  else
 	    args=( ':branch:__git_branch_names' )
+	  else
+	    args=( ':commit:__git_commits' )
 	  fi
           _arguments \
 	    '(-f --force)'{-f,--force}'[checkout branch even if already checked out in another worktree]' \