about summary refs log tree commit diff
diff options
context:
space:
mode:
authorm0viefreak <m0viefreak.cm@googlemail.com>2014-02-17 05:00:38 +0100
committerFrank Terbeck <ft@bewatermyfriend.org>2014-02-18 12:22:21 +0100
commitf8e874ef9d2d44f571517d90b2cd2181f4380778 (patch)
treef37871b83c31b779f6e98f65f111df4544a6a324
parent139ee0e351d8b79f25319054714ec669d13ae87e (diff)
downloadzsh-f8e874ef9d2d44f571517d90b2cd2181f4380778.tar.gz
zsh-f8e874ef9d2d44f571517d90b2cd2181f4380778.tar.xz
zsh-f8e874ef9d2d44f571517d90b2cd2181f4380778.zip
32397: _git: fix __git_submodules to only use the actual name of the submodule
The output of 'submodule status' is

Xsha1 name (describe)

X being one of -,+,U,[space]

We are only interested in the name part and not the whole line.

Fix the parameter expansions accordingly.
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_git2
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 780eb5944..76c2d8a21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
 	* 32395: Completion/Unix/Command/_git: _git: diff: refactor and
 	fix wrong completions
 
+	* 32397: Completion/Unix/Command/_git: _git: fix __git_submodules
+	to only use the actual name of the submodule
+
 2014-02-17  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* unposted (users/18468): Doc/Zsh/builtins.yo, Doc/Zsh/params.yo:
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index e9905cce6..a8a8786e1 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5548,7 +5548,7 @@ __git_submodules () {
   local expl
   declare -a submodules
 
-  submodules=(${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#* })
+  submodules=(${${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#?* }%% *})
   __git_command_successful $pipestatus || return 1
 
   _wanted submodules expl submodule compadd $* - $submodules