[PATCH 1/3] completion: be nicer with zsh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]