about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_git14
2 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c589526e2..e76279690 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
 	* 29518: Completion/Unix/Command/_git: Fall back to file
 	completion for unknown sub-commands.
 
+	* 29527: Completion/Unix/Command/_git: Make file-completion
+	fallback optional.
+
 2011-06-30  Frank Terbeck  <ft@bewatermyfriend.org>
 
 	* 29526: Functions/VCS_Info/vcs_info: Set `max-exports' early
@@ -15062,5 +15065,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5384 $
+* $Revision: 1.5385 $
 *****************************************************
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