summary refs log tree commit diff
path: root/Completion/Unix/Command/_git
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_git')
-rw-r--r--Completion/Unix/Command/_git9
1 files changed, 8 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index dcf1f639c..aacd3bfd7 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -756,7 +756,8 @@ _git-diff () {
     $diff_options \
     '(--exit-code)--quiet[disable all output]' \
     $diff_stage_options \
-    '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \
+    '(--cached --staged)--no-index[show diff between two paths on the filesystem]' \
+    '(--cached --staged --no-index)'{--cached,--staged}'[show diff between index and named commit]' \
     '(-)--[start file arguments]' \
     '*:: :->from-to-file' && ret=0
 
@@ -774,6 +775,12 @@ _git-diff () {
         return ret
       fi
 
+      # If "--no-index" was given, only file paths need to be completed.
+      if [[ -n ${opt_args[(I)--no-index]} ]]; then
+        _alternative 'files::_files' && ret=0
+        return ret
+      fi
+
       # Otherwise, more complex conditions need to be checked.
       case $CURRENT in
         (1)