Thread (13 messages) flat view 13 messages, 3 authors, 2021-07-22

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

From: Taylor Blau <hidden>
Date: 2021-07-22 18:20:23

On Thu, Jul 22, 2021 at 01:53:54AM +0200, Ævar Arnfjörð Bjarmason wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help