4 local curcontext="$curcontext" state line
16 'init:Initialize a new git repo with support for the branching model.'
17 'feature:Manage your feature branches.'
18 'release:Manage your release branches.'
19 'hotfix:Manage your hotfix branches.'
20 'support:Manage your support branches.'
21 'version:Shows version information.'
23 _describe -t commands 'git flow' subcommands
31 -f'[Force setting of gitflow branches, even if already configured]'
53 __git-flow-release () {
54 local curcontext="$curcontext" state line
58 ':command:->command' \
59 '*::options:->options'
66 'start:Start a new release branch.'
67 'finish:Finish a release branch.'
68 'list:List all your release branches. (Alias to `git flow release`)'
72 _describe -t commands 'git flow release' subcommands
74 -v'[Verbose (more) output]'
82 -F'[Fetch from origin before performing finish]'\
83 ':version:__git_flow_version_list'
88 -F'[Fetch from origin before performing finish]' \
89 -s'[Sign the release tag cryptographically]'\
90 -u'[Use the given GPG-key for the digital signature (implies -s)]'\
91 -m'[Use the given tag message]'\
92 -p'[Push to $ORIGIN after performing finish]'\
93 -k'[Keep branch after performing finish]'\
94 -n"[Don't tag this release]"\
95 ':version:__git_flow_version_list'
100 ':version:__git_flow_version_list'\
105 ':version:__git_flow_version_list'\
110 -v'[Verbose (more) output]'
117 __git-flow-hotfix () {
118 local curcontext="$curcontext" state line
122 ':command:->command' \
123 '*::options:->options'
130 'start:Start a new hotfix branch.'
131 'finish:Finish a hotfix branch.'
132 'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
134 _describe -t commands 'git flow hotfix' subcommands
136 -v'[Verbose (more) output]'
144 -F'[Fetch from origin before performing finish]'\
145 ':hotfix:__git_flow_version_list'\
146 ':branch-name:__git_branch_names'
151 -F'[Fetch from origin before performing finish]' \
152 -s'[Sign the release tag cryptographically]'\
153 -u'[Use the given GPG-key for the digital signature (implies -s)]'\
154 -m'[Use the given tag message]'\
155 -p'[Push to $ORIGIN after performing finish]'\
156 -k'[Keep branch after performing finish]'\
157 -n"[Don't tag this release]"\
158 ':hotfix:__git_flow_hotfix_list'
163 -v'[Verbose (more) output]'
170 __git-flow-feature () {
171 local curcontext="$curcontext" state line
175 ':command:->command' \
176 '*::options:->options'
183 'start:Start a new feature branch.'
184 'finish:Finish a feature branch.'
185 'list:List all your feature branches. (Alias to `git flow feature`)'
193 _describe -t commands 'git flow feature' subcommands
195 -v'[Verbose (more) output]'
203 -F'[Fetch from origin before performing finish]'\
204 ':feature:__git_flow_feature_list'\
205 ':branch-name:__git_branch_names'
210 -F'[Fetch from origin before performing finish]' \
211 -r'[Rebase instead of merge]'\
212 -k'[Keep branch after performing finish]'\
213 ':feature:__git_flow_feature_list'
218 ':feature:__git_flow_feature_list'\
223 ':feature:__git_flow_feature_list'\
228 ':branch:__git_flow_feature_list'\
233 -i'[Do an interactive rebase]' \
234 ':branch:__git_flow_feature_list'
239 ':branch:__git_flow_feature_list'\
244 ':remote:__git_remotes'\
245 ':branch:__git_flow_feature_list'
250 -v'[Verbose (more) output]'
257 __git_flow_version_list () {
261 versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
262 __git_command_successful || return
264 _wanted versions expl 'version' compadd $versions
267 __git_flow_feature_list () {
271 features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
272 __git_command_successful || return
274 _wanted features expl 'feature' compadd $features
278 local expl gitdir remotes
280 gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
281 __git_command_successful || return
283 remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
284 __git_command_successful || return
286 # TODO: Should combine the two instead of either or.
287 if (( $#remotes > 0 )); then
288 _wanted remotes expl remote compadd $* - $remotes
290 _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
294 __git_flow_hotfix_list () {
298 hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
299 __git_command_successful || return
301 _wanted hotfixes expl 'hotfix' compadd $hotfixes
304 __git_branch_names () {
306 declare -a branch_names
308 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
309 __git_command_successful || return
311 _wanted branch-names expl branch-name compadd $* - $branch_names
314 __git_command_successful () {
315 if (( ${#pipestatus:#0} > 0 )); then
316 _message 'not a git repository'
322 zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
324 # Detect if script is sourced or called via autoload
325 [[ "$ZSH_EVAL_CONTEXT" != *:file ]] || return