[PATCH 1/3] completion: be nicer with zsh
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Jan 29, 2012, 23:41 UTC
- Message-ID
- <1327880479-25275-2-git-send-email-felipe.contreras@gmail.com>
- In-Reply-To
- <1327880479-25275-1-git-send-email-felipe.contreras@gmail.com>
And yet another bug in zsh[1] causes a mismatch; zsh seems to have problem emulating wordspliting, but only when the ':' command is involved.
Let's avoid it. This has the advantage that the code is now actually understandable (at least to me), while before it looked like voodoo.
I found this issue because __git_compute_porcelain_commands listed all commands (not only porcelain).
[1] http://article.gmane.org/gmane.comp.shells.zsh.devel/24296
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- contrib/completion/git-completion.bash | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1496c6d..7051c7a 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -676,7 +676,8 @@ __git_merge_strategies= # is needed. __git_compute_merge_strategies () { - : ${__git_merge_strategies:=$(__git_list_merge_strategies)} + test "$__git_merge_strategies" && return + __git_merge_strategies=$(__git_list_merge_strategies 2> /dev/null) } __git_complete_revlist_file () @@ -854,7 +855,8 @@ __git_list_all_commands () __git_all_commands= __git_compute_all_commands () { - : ${__git_all_commands:=$(__git_list_all_commands)} + test "$__git_all_commands" && return + __git_all_commands=$(__git_list_all_commands 2> /dev/null) } __git_list_porcelain_commands () @@ -947,7 +949,8 @@ __git_porcelain_commands= __git_compute_porcelain_commands () { __git_compute_all_commands - : ${__git_porcelain_commands:=$(__git_list_porcelain_commands)} + test "$__git_porcelain_commands" && return + __git_porcelain_commands=$(__git_list_porcelain_commands 2> /dev/null) } __git_pretty_aliases ()
-- 1.7.8.3