Re: [PATCH 2/2] bundle tests: use test_cmp instead of grep

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

 



On Thu, Jul 22, 2021 at 01:53:54AM +0200, Ævar Arnfjörð Bjarmason wrote:
> > Or, if you wanted to go further, you could do something like:
> >
> >     cat >expect <<-EOF
> >     $(test_have_prereq SHA1 || echo "@object-format=sha256")
> >     -$(git log --pretty=format:"%H %s" -1 HEAD^)
> >     $(git rev-parse HEAD) HEAD
> >     EOF
> >
> > which is arguably a little tighter (although I find the
> > echo-in-a-heredoc thing to be kind of ugly).
>
> This one won't work because you'll have an empty line at the start under
> SHA-1.

Ah, you're totally right: good catch. I think it's avoidable by smashing
the first two lines into one. If the subshell prints nothing, then the
first line will start with "-$(git log ...)", otherwise, if it does
print something, then the echo will print a newline to separate it from
the "-$(git log ...) output which will go on the second line.

But that is definitely uglier than my first suggestion, so I'm glad that
you didn't try and make what I wrote above work :).

Thanks,
Taylor



[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