Subject: Re: [PATCH] tests: make 'test_oid' print trailing newline

From: Junio C Hamano <[email-masked]>
Date: Mon, 19 Dec 2022 09:48:49 +0900

SZEDER Gábor <[email-masked]> writes:

> Unlike other test helper functions, 'test_oid' doesn't terminate its
> output with a LF, but, alas, the reason for this, if any, is not
> mentioned in 2c02b110da (t: add test functions to translate
> hash-related values, 2018-09-13)).

I (obviously) agree with the analysis in the proposed log message.
Having to touch the sanity checking tests in 0-basic is a bit
annoying, but having to do an artificial echo is even more annoying,
so these changes may probably be a net win, I would say.

Having said that.

>       $ git grep '\stest_oid ' -- ':/t/*.sh'
>       $ git grep 'echo "\?$(test_oid ' -- ':/t/*.sh'

I found these examples in the log message a bit annoying to see, as
both invite an undefined behaviour by having an ordinary character
('s' or '?')  preceded by an unescaped backslash in a POSIXly
correct implementation of BRE.  GNU libc seems to be OK with it (I
double checked by adding "-G" on the command line to make sure my
experiments are not affected by any grep.patterntype), but they may
fail for folks on stricter platforms.

Thanks.  Will queue.