Jeff King <p...@peff.net> writes:

> On Tue, Apr 28, 2015 at 10:39:44PM -0700, Junio C Hamano wrote:
>
>> Jeff King <p...@peff.net> writes:
>> 
>> > I'm not sure of a solution short of replacing the use of sed here with
>> > something else. perl would be a simple choice, but filter-branch does
>> > not otherwise depend on it. We could use a shell "read" loop, but those
>> > are quite slow (and filter-branch is slow enough as it is!).
>> 
>> You need to only skip the header part, right?
>> I would imagine that
>> 
>> (
>>      while read x && test -n "$x"
>>         do
>>              :;
>>      done
>>      cat
>> ) <../commit | eval "$filter_msg"
>> 
>> would not spin too much in shell loop, perhaps?
>
> Yeah, that is not too bad. Probably we want "read -r", just in case of
> weirdness in the header lines (and that's in POSIX, and we use it
> in other scripts, so it should be portable enough). And we can save a
> subshell if we don't mind the potential variable-name conflict.

As all we care about is "have we hit an empty line", I do not think "-r"
really matters, but it would not hurt.

As to s/()/{}/, please tell me what I am doing wrong.  I am getting
the same process IDs from all of the $$s and the only difference
seems to be variable clobbering.

-- >8 --
#!/bin/sh

cat >/var/tmp/tester <<EOF || exit
a
b

c
d
EOF


x=foo
echo "My id is $$"
(
        echo "inside paren $$"
        while read x && test -n "$x"
        do
                :;
        done
        cat
) </var/tmp/tester
echo "x=<$x>"

x=foo
{
        echo "inside brace $$"
        while read x && test -n "$x"
        do
                :;
        done
        cat
} </var/tmp/tester
echo "x=<$x>"
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to