summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_git
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_git')
-rw-r--r--Completion/Unix/Command/_git14
1 files changed, 9 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 9a44ddbbe..15280db70 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1567,13 +1567,17 @@ _git-restore() {
case $state in
pathspecs)
- if [[ -z ${opt_args[(I)-s|--source|-S|--staged]} ]] &&
- # use index as a default base unless -S is specified
- __git_ignore_line __git_modified_files
+ integer opt_S opt_W
+ [[ -n ${opt_args[(I)-S|--staged]} ]] && opt_S=1
+ [[ -n ${opt_args[(I)-W|--worktree]} ]] && opt_W=1
+ if (( opt_S && opt_W ))
then
- ret=0
+ __git_ignore_line __git_changed_files && ret=0
+ elif (( opt_S ))
+ then
+ __git_ignore_line __git_changed-in-index_files && ret=0
else
- __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Qv)opt_args[(i)-s|--source]:-HEAD} && ret=0
+ __git_ignore_line __git_changed-in-working-tree_files && ret=0
fi
;;
sources)