summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
authorFrank Terbeck <bewater@users.sourceforge.net>2011-07-01 07:37:44 +0000
committerFrank Terbeck <bewater@users.sourceforge.net>2011-07-01 07:37:44 +0000
commitf5ba9011f04b56495b665d5a5f334bd2eacf002f (patch)
tree305a60d1fc190709f32170144c944e858c7cbbcc /Completion/Unix
parent3761265e452af7a31d9c7c10ed6900deeb5291c4 (diff)
downloadzsh-f5ba9011f04b56495b665d5a5f334bd2eacf002f.tar.gz
zsh-f5ba9011f04b56495b665d5a5f334bd2eacf002f.tar.xz
zsh-f5ba9011f04b56495b665d5a5f334bd2eacf002f.zip
29527: _git: Make file-completion fallback optional.
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_git14
1 files changed, 13 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 362ec7812..e9eaa86c8 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -17,6 +17,16 @@
 #
 # You could even create a function _git-foo() to handle specific completion
 # for that command.
+#
+# When _git does not know a given sub-command (say `bar'), it falls back to
+# completing file names for all arguments to that sub command. I.e.:
+#
+#     % git bar <tab>
+#
+# ...will complete file names. If you do *not* want that fallback to be used,
+# use the `use-fallback' style like this:
+#
+#     % zstyle ':completion:*:*:git*:*' use-fallback false
 
 # TODO: There is still undocumented configurability in here.
 
@@ -6025,9 +6035,11 @@ _git() {
 
         if (( ${+functions[_git-$words[1]]} )); then
             _git-$words[1]
-        else
+        elif zstyle -T ":completion:${curcontext}:" use-fallback; then
             _path_files
             ret=$?
+        else
+            _message 'Unknown sub-command'
         fi
         ;;
     esac