Re: [PATCH 2/7] t: introduce tests for unexpected object types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 8, 2019 at 10:31 PM Taylor Blau <me@xxxxxxxxxxxx> wrote:
> On Mon, Apr 08, 2019 at 03:44:25PM +0900, Junio C Hamano wrote:
> > Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:
> > >> > > +   git cat-file commit $commit |
> > >> > > +           perl -lpe "/^author/ && print q(parent $blob)" \
> > >> > > +           >broken-commit &&
> > >
> > > 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? ;-).

I suspect that Junio's "Looks good" was referring to the 'sed expression.

With all the recent work of moving away from having Git upstream of a
pipe, let's not intentionally introduce a new instance. I wrote the
example 'sed' expression that way merely to mirror how the original
'perl' version was written to make it easier to see the equivalence
(not because it was intended as an endorsement of having Git upstream
of a pipe).



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux