Re: [PATCH v2 4/4] completion: be nicer with zsh
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jan 30, 2012, 17:53 UTC
- Message-ID
- <20120130175324.GH10618@burratino>
- In-Reply-To
- <1327944197-6379-5-git-send-email-felipec@infradead.org>
Felipe Contreras wrote:
Show 9 quoted lines
> --- 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?