about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-06-25 16:34:58 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-06-27 00:21:02 +0000
commit3a034838b4a76924a7fff98c269c9c3ea3136d45 (patch)
treec23a5889e618a08c5e0d228016250dbd7e25ac28
parent3bd8abc40bf9c218e1ddd23bfd804422b0684c0a (diff)
downloadzsh-3a034838b4a76924a7fff98c269c9c3ea3136d45.tar.gz
zsh-3a034838b4a76924a7fff98c269c9c3ea3136d45.tar.xz
zsh-3a034838b4a76924a7fff98c269c9c3ea3136d45.zip
38760: _git-config: Stop trying to execute the empty string command name upon completing values for an unknown option.
For example:

% git config x.y.z <TAB>
+_git-config:834> case x.y.z (alias.*)
+_git-config:834> case x.y.z (remotes.*)
+_git-config:860> local z=$'\C-@'
+_git-config:861> declare -a parts
+_git-config:862> parts=( '' )
+_git-config:863> ((  1 < 2  ))
+_git-config:863> [[ x.y.z == [^.]##.*.[^.]## ]]
+_git-config:864> parts=( '' )
+_git-config:866> ((  1 > 0  ))
+_git-config:867> case  (-\>*)
+_git-config:867> case  (*)
+_git-config:1197> declare -a action
+_git-config:1198> _description values expl ''
+_git-config:1199> eval 'action=()'
+(eval):1> action=( )
+_git-config:1200> '' -J values
_git-config:1200: permission denied:
+_git-config:1206> return ret
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_git2
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c2f15f6a5..503b905f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-27  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 38760: Completion/Unix/Command/_git: _git-config: Stop trying
+	to execute the empty string command name upon completing values
+	for an unknown option.
+
 2016-06-25  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* unposted: Completion/Unix/Command/_git: _git-config: Document
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 5cc144963..739fff1db 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -2603,7 +2603,7 @@ _git-config () {
       if (( $#parts < 2 )) && [[ $line[1] == [^.]##.*.[^.]## ]]; then
         parts=("${(S@0)${git_options_static[(r)(#i)${line[1]%%.*}.\*.${line[1]##*.}:*]}//(#b)(*[^\\]|):/$match[1]$z}")
       fi
-      (( $#parts > 0 )) || return ret
+      (( $#parts >= 4 )) || return ret
       case $parts[4] in
         ('->'*)
           case ${parts[4]#->} in