Re: [PATCH 2/7] t: introduce tests for unexpected object types
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Apr 9, 2019, 02:30 UTC
- Message-ID
- <20190409023055.GF81620@Taylors-MBP.hsd1.wa.comcast.net>
- In-Reply-To
- <xmqqbm1h9et2.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Mon, Apr 08, 2019 at 03:44:25PM +0900, Junio C Hamano wrote:
Show 23 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
>
> > On Fri, Apr 5, 2019 at 2:24 PM Jeff King <peff@peff.net> wrote:
> >> On Fri, Apr 05, 2019 at 12:50:33PM +0200, SZEDER Gábor wrote:
> >> > > + git cat-file commit $commit |
> >> > > + perl -lpe "/^author/ && print q(parent $blob)" \
> >> > > + >broken-commit &&
> >>
> >> > Wouldn't a 'sed' one-liner suffice, so we won't have yet another perl
> >> > dependency?
> >>
> >> Heh, this was actually the subject of much discussion before the patches
> >> hit the list. If you can write such a one-liner that is both readable
> >> and portable, please share it. I got disgusted with sed and suggested
> >> this perl.
> >
> > Trivial and portable 'sed' equivalent:
> >
> > git cat-file commit $commit | sed "/^author/ { h; s/.*/parent $blob/; G; }"
>
> Looks good. I had a bit of head scratching moment when I saw that
> "perl -lpe" one-liner; this sed expression may not be crystal clear
> to those who are not used to, but it is not so bad, either.Should I take this as your endorsement of putting 'git' on the left-hand side of a pipe? ;-).
Thanks, Taylor