summary refs log tree commit diff
path: root/Completion/Unix/Command/_git
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2018-09-11 13:24:20 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2018-09-12 15:12:07 +0000
commit7ae2be3a2fd7e3be2b6f3990cb4c0ca164cf72d1 (patch)
treef0961c2a3b54963249557a88ca7a6d57193aa129 /Completion/Unix/Command/_git
parent07ad7fd97086e108c87bf87b23d919365ff10c5c (diff)
downloadzsh-7ae2be3a2fd7e3be2b6f3990cb4c0ca164cf72d1.tar.gz
zsh-7ae2be3a2fd7e3be2b6f3990cb4c0ca164cf72d1.tar.xz
zsh-7ae2be3a2fd7e3be2b6f3990cb4c0ca164cf72d1.zip
43442: _git: Break out a helper function.
Diffstat (limited to 'Completion/Unix/Command/_git')
-rw-r--r--Completion/Unix/Command/_git8
1 files changed, 6 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 2cae4c82f..b2f93ff0f 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -2108,8 +2108,7 @@ _git-worktree() {
 	;;
       esac
       if [[ $state = worktrees ]]; then
-        _wanted directories expl 'working tree' compadd -S ' ' -f -M 'r:|/=* r:|=*' \
-            ${${(M)${(f)"$(_call_program directories git worktree list --porcelain)"}:#worktree*}#* } && ret=0
+        __git_worktrees && ret=0
       fi
     ;;
   esac
@@ -7561,6 +7560,11 @@ __git_browsers () {
     'builtin-browsers:builtin browser:compadd -a - builtinbrowsers'
 }
 
+__git_worktrees () {
+  _wanted directories expl 'working tree' compadd -S ' ' -f -M 'r:|/=* r:|=*' \
+    ${${(M)${(f)"$(_call_program directories git worktree list --porcelain)"}:#worktree*}#* }
+}
+
 (( $+functions[__git_difftools] )) ||
 __git_difftools () {
   __git_diff-or-merge-tools diff $*