1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

25491: patch to improve "git checkout" completion, from Mikael Magnusson.

This commit is contained in:
Clint Adams 2008-08-21 00:13:07 +00:00
parent 0d07bf44e7
commit d5a328eafc
2 changed files with 27 additions and 17 deletions

View file

@ -1,3 +1,8 @@
2008-08-21 Clint Adams <clint@zsh.org>
* 25491: Completion/Unix/Command/_git: patch to improve
"git checkout" completion, from Mikael Magnusson.
2008-08-19 Clint Adams <clint@zsh.org> 2008-08-19 Clint Adams <clint@zsh.org>
* 25490: Src/zsh.h, Src/Modules/db_gdbm.c: make zties dynamic so * 25490: Src/zsh.h, Src/Modules/db_gdbm.c: make zties dynamic so

View file

@ -1543,24 +1543,29 @@ _git-checkout () {
new_branch_reflog_arg='-l[create the new branch'\''s reflog]' new_branch_reflog_arg='-l[create the new branch'\''s reflog]'
fi fi
# TODO: This isnt quite correct in regards of the handling of the “--” if (( words[(I)--] > 0 && words[(I)--] < CURRENT )); then
# option, as it should prevent us from seeing a branch, not stop matching _arguments -C -S \
# options. - update-files \
_arguments -C -S -A "-*" \ '*::file:->files' && ret=0
- switch-branch \ else
'-q[suppress feedback messages]' \ _arguments -C -S \
'-f[force a complete re-read]' \ - switch-branch \
'-b[create a new branch based at given branch]: :__git_guard_branch-name' \ '-q[suppress feedback messages]' \
{-t,--track}'[set up configuration so pull merges from the start point]' \ '-f[force a complete re-read]' \
'--no-track[override the branch.autosetupmerge configuration variable]' \ '-b[create a new branch based at given branch]: :__git_guard_branch-name' \
'-l[create the branch'\''s reflog]' \ {-t,--track}'[set up configuration so pull merges from the start point]' \
$new_branch_reflog_arg \ '--no-track[override the branch.autosetupmerge configuration variable]' \
'-m[3way merge current branch, working tree and new branch]' \ '-l[create the branch'\''s reflog]' \
'::branch:__git_revisions' \ $new_branch_reflog_arg \
- update-files \ '-m[3way merge current branch, working tree and new branch]' \
'::tree-ish:__git_tree_ishs' \ '::branch:__git_revisions' \
'::file:->files' && ret=0 - update-files \
'::tree-ish:__git_tree_ishs' \
'*::file:->files' && ret=0
fi
#XXX TODO and all that: $line[1] only works if you didn't write any options.
#What's the variable that holds the tree-ish argument? Is it even reliably possible?
case $state in case $state in
(files) (files)
if [[ -n $line[1] ]]; then if [[ -n $line[1] ]]; then