From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
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 12:43:15 -0400 [thread overview]
Message-ID: <20150429164315.GA26682@peff.net> (raw)
In-Reply-To: <xmqqioce6gon.fsf@gitster.dls.corp.google.com>
On Wed, Apr 29, 2015 at 09:30:00AM -0700, Junio C Hamano wrote:
> >> (
> >> 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.
I think something like:
author ...
committer ...
encoding foo\
this is the real commit message
would behave incorrectly without "-r". I would be shocked if that ever
happens in real life, but I think it doesn't hurt to be careful.
> 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.
$$ is always the pid of the main shell process, even in a subshell. If
your shell is bash, it provides $BASHPID which can tell the difference
(if you put $BASHPID in your test script, it does show that we fork for
the subshell).
On Linux, you can also test with "strace -fce clone". Interestingly,
dash produces one fewer fork than bash on your test script, but I didn't
track down the exact difference. But I can imagine a shell that is smart
enough to realize a fork is not required in this instance.
-Peff
next prev parent reply other threads:[~2015-04-29 16:43 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
2015-04-29 16:43 ` Jeff King [this message]
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=20150429164315.GA26682@peff.net \
--to=peff@peff.net \
--cc=cyrus-dev@edla.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).