diff options
Diffstat (limited to 'Completion/Unix/Command')
| -rw-r--r-- | Completion/Unix/Command/_git | 77 |
1 files changed, 44 insertions, 33 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8562ab21a..e9905cce6 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -722,63 +722,74 @@ _git-diff () { case $state in (from-to-file) + # If "--" is part of $opt_args, this means it was specified before any + # $words arguments. This means that no heads are specified in front, so + # we need to complete *changed* files only. + if [[ -n ${opt_args[(I)--]} ]]; then + if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then + __git_changed-in-index_files && ret=0 + else + __git_changed-in-working-tree_files && ret=0 + fi + return ret + fi + + # Otherwise, more complex conditions need to be checked. case $CURRENT in (1) - if [[ -n ${opt_args[(I)--]} ]]; then - if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then |
