Re: [PATCH] bash completion: use read -r everywhere
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 21, 2011, 19:23 UTC
- Message-ID
- <7v1urxhgpw.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <87wr9pkahw.fsf@thomas.inf.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
> Perhaps we can then just fold it into the first paragraph after the > POSIX quote, like
Well, that is what I tried say so we are on the same page ;-).
Show 7 quoted lines
> We use the 'read' command without -r, so that it treats '\' as an > escape character, in several places. This breaks the loop reading > refnames from git-for-each-ref in __git_refs() if there are refnames > such as "foo'bar", in which case for-each-ref helpfully quotes them as > in > > Or some such. Do you want me to resend?
Nah, The above as-is is perfectly fine.
By the way, this is not a problem with the patch, but the for-each-ref loop is a poor example. Its --shell option is meant to produce a scriptlet that can be evaled without the buggy processing loop you are fixing, i.e.
script=$(git for-each-ref --shell --format='
ref=%(refname:short)
ref=${ref#*/}
if [[ "$ref" == "$cur"* ]]
then
...
' refs/remotes/) &&
eval "$script"is how it was designed to be used avoiding shell loops.
>> Does this regress for zsh users in some ways, by the way? > > I'm not one of them, but...
Thanks, that was all I wanted to know before deciding if I should apply this directly to 'master' or cook in 'next' to give real zsh users a chance to object or tweak it.