Thread (5 messages) 5 messages, 2 authors, 2016-06-15

Re: [PATCH v2 4/4] completion: be nicer with zsh

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:52:53

Felipe Contreras wrote:
quoted hunk
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -657,7 +657,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)
Why the new redirect?  If I add debugging output to
__git_list_merge_strategies that writes to stderr, I want to see it.

Why the 'test "$foo"' form instead of [[ -n which is more common in
this completion script?  Why use "return" instead of

	[[ -n $var ]] || var=$(...)

which feels a little simpler?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help