diff options
author | Nikolai Weibull <pcppopper@users.sourceforge.net> | 2011-07-21 10:03:09 +0000 |
---|---|---|
committer | Nikolai Weibull <pcppopper@users.sourceforge.net> | 2011-07-21 10:03:09 +0000 |
commit | 3eb08466453403c6ac3f5f84405b91f1ed007bfb (patch) | |
tree | 275a625bb6bac25c209b2d7a9612603f3b2acab2 | |
parent | d37eda52f30cc50aa1908ca0a7abc99719a63d50 (diff) | |
download | zsh-3eb08466453403c6ac3f5f84405b91f1ed007bfb.tar.gz zsh-3eb08466453403c6ac3f5f84405b91f1ed007bfb.tar.xz zsh-3eb08466453403c6ac3f5f84405b91f1ed007bfb.zip |
unposted: Completion/Unix/Command/_git: Update git-add completion to not
complete already given file arguments and also to not list file completions if an option is being completed.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 17 |
2 files changed, 15 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog index 2e02bbab6..c1f1c75ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ * unposted: Completion/Unix/Command/_git: Fix bug in git-add completion that prevented -f option from being used correctly. + * unposted: Completion/Unix/Command/_git: Update git-add completion to + not complete already given file arguments and also to not list file + completions if an option is being completed. + 2011-07-19 Peter Stephenson <pws@csr.com> * 29555: Src/exec.c: fix problem that shell failed to use file @@ -15131,5 +15135,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5401 $ +* $Revision: 1.5402 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b41cb4b19..2fdc4d61c 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -57,21 +57,20 @@ _git-add () { '--refresh[do not add files, but refresh their stat() info in index]' \ '--ignore-errors[continue adding if an error occurs]' \ $ignore_missing \ - '*:: :->file' && ret=0 + '*:: :->file' && return case $state in (file) - # TODO: Use __git_ignore_line_inside_arguments. declare -a ignored_files_alternatives if [[ -n ${opt_args[(I)-f|--force]} ]]; then ignored_files_alternatives=( - 'ignored-modified-files:ignored modified files:__git_modified_files --ignored' - 'ignored-other-files:ignored other files:__git_other_files --ignored') + 'ignored-modified-files:ignored modified files:__git_ignore_line_inside_arguments __git_modified_files --ignored' + 'ignored-other-files:ignored other files:__git_ignore_line_inside_arguments __git_other_files --ignored') fi _alternative \ - 'modified-files::__git_modified_files' \ - 'other-files::__git_other_files' \ + 'modified-files::__git_ignore_line_inside_arguments __git_modified_files' \ + 'other-files::__git_ignore_line_inside_arguments __git_other_files' \ $ignored_files_alternatives && ret=0 ;; esac @@ -4524,7 +4523,11 @@ __git_ignore_line () { (( $+functions[__git_ignore_line_inside_arguments] )) || __git_ignore_line_inside_arguments () { - __git_ignore_line ${*[-1]} ${*[1,-2]} + declare -a compadd_opts + + zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + + __git_ignore_line $* $compadd_opts } # Common Argument Types |