public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Olivier ROLAND <cyrus-dev@edla•org>, git@vger•kernel.org
Subject: Re: Bug report : bad filter-branch (OSX only)
Date: Wed, 29 Apr 2015 09:30:00 -0700	[thread overview]
Message-ID: <xmqqioce6gon.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150429154857.GA13518@peff.net> (Jeff King's message of "Wed, 29 Apr 2015 11:48:58 -0400")

Jeff King <peff@peff•net> writes:

> On Tue, Apr 28, 2015 at 10:39:44PM -0700, Junio C Hamano wrote:
>
>> Jeff King <peff@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>"

  reply	other threads:[~2015-04-29 16:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26  9:25 Bug report : bad filter-branch (OSX only) Olivier ROLAND
2015-04-28  5:55 ` Jeff King
2015-04-28 11:02   ` Olivier ROLAND
2015-04-29  4:39     ` Jeff King
2015-04-29  4:56       ` Jeff King
2015-04-29  5:39         ` Junio C Hamano
2015-04-29 15:48           ` Jeff King
2015-04-29 16:30             ` Junio C Hamano [this message]
2015-04-29 16:43               ` Jeff King
2015-04-29 17:13                 ` Junio C Hamano
2015-04-29 18:17               ` Johannes Sixt
2015-04-29 14:42 ` Roberto Tyley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqioce6gon.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=cyrus-dev@edla$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox