mbox series

[0/3] fix failing t4301 test and &&-chain breakage

Message ID pull.1339.git.1661663879.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series fix failing t4301 test and &&-chain breakage | expand

Message

Jean-Noël Avila via GitGitGadget Aug. 28, 2022, 5:17 a.m. UTC
This series fixes a failing test in t4301 due to 'sed' behavioral
differences between implementations. It also fixes a couple broken &&-chains
and adds missing explicit loop termination.

The third patch is entirely subjective and can be dropped if unwanted. I
spent more than a few minutes puzzling over the script's use of 'printf
"\\n"' rather than the more typical 'printf "\n"' or even a simple 'echo',
wondering if there was some subtlety I was missing or whether Elijah had
encountered an unusual situation in which '\\n' was needed over '\n'. The
third patch chooses to replace 'printf "\\n"' with 'echo' which I find more
idiomatic, but I can see value in using 'printf "\n"' as perhaps being
clearer that it is adding a newline where one is missing.

The series is built atop 'en/t4301-more-merge-tree-tests' which is already
in 'next'.

Eric Sunshine (3):
  t4301: account for behavior differences between sed implementations
  t4031: fix broken &&-chains and add missing loop termination
  t4301: emit blank line in more idiomatic fashion

 t/t4301-merge-tree-write-tree.sh | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)


base-commit: 3c4dbf556f425d83f3fbb729dcbecdc719ee4099
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1339%2Fsunshineco%2Fanonhash-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1339/sunshineco/anonhash-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1339

Comments

Junio C Hamano Aug. 28, 2022, 8:05 p.m. UTC | #1
"Eric Sunshine via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Eric Sunshine (3):
>   t4301: account for behavior differences between sed implementations
>   t4031: fix broken &&-chains and add missing loop termination
>   t4301: emit blank line in more idiomatic fashion
>
>  t/t4301-merge-tree-write-tree.sh | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)

The second one is off by 270.
Eric Sunshine Aug. 28, 2022, 8:46 p.m. UTC | #2
On Sun, Aug 28, 2022 at 4:05 PM Junio C Hamano <gitster@pobox.com> wrote:
> "Eric Sunshine via GitGitGadget" <gitgitgadget@gmail.com> writes:
> >   t4301: account for behavior differences between sed implementations
> >   t4031: fix broken &&-chains and add missing loop termination
> >   t4301: emit blank line in more idiomatic fashion
>
> The second one is off by 270.

Shall I re-roll or will you fix it while queuing (assuming you queue it)?
Junio C Hamano Aug. 29, 2022, 5:36 a.m. UTC | #3
Eric Sunshine <sunshine@sunshineco.com> writes:

> On Sun, Aug 28, 2022 at 4:05 PM Junio C Hamano <gitster@pobox.com> wrote:
>> "Eric Sunshine via GitGitGadget" <gitgitgadget@gmail.com> writes:
>> >   t4301: account for behavior differences between sed implementations
>> >   t4031: fix broken &&-chains and add missing loop termination
>> >   t4301: emit blank line in more idiomatic fashion
>>
>> The second one is off by 270.
>
> Shall I re-roll or will you fix it while queuing (assuming you queue it)?

I plan to fix it up when I queue.
Elijah Newren Aug. 30, 2022, 2:52 a.m. UTC | #4
On Sat, Aug 27, 2022 at 10:18 PM Eric Sunshine via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> This series fixes a failing test in t4301 due to 'sed' behavioral
> differences between implementations. It also fixes a couple broken &&-chains
> and adds missing explicit loop termination.
>
> The third patch is entirely subjective and can be dropped if unwanted. I
> spent more than a few minutes puzzling over the script's use of 'printf
> "\\n"' rather than the more typical 'printf "\n"' or even a simple 'echo',
> wondering if there was some subtlety I was missing or whether Elijah had
> encountered an unusual situation in which '\\n' was needed over '\n'. The
> third patch chooses to replace 'printf "\\n"' with 'echo' which I find more
> idiomatic, but I can see value in using 'printf "\n"' as perhaps being
> clearer that it is adding a newline where one is missing.

I can't actually provide the reasoning for it; I took Dscho's testcase
from [1] and used it as a basis for adding several other testcases.
When I was copying & pasting and adjusting, I just didn't notice the
'printf "\\n"'.  But using a simple echo makes sense.

[1] https://lore.kernel.org/git/3b4ed8bb1bb615277ee51a7b2af5fc53bae0a6e4.1660892256.git.gitgitgadget@gmail.com/

Anyway, I've read through the patches and your series looks good to me.
Elijah Newren Aug. 30, 2022, 2:53 a.m. UTC | #5
On Sun, Aug 28, 2022 at 1:05 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Eric Sunshine via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > Eric Sunshine (3):
> >   t4301: account for behavior differences between sed implementations
> >   t4031: fix broken &&-chains and add missing loop termination
> >   t4301: emit blank line in more idiomatic fashion
> >
> >  t/t4301-merge-tree-write-tree.sh | 24 ++++++++++++------------
> >  1 file changed, 12 insertions(+), 12 deletions(-)
>
> The second one is off by 270.

Apparently Eric knew what you meant, but I'm perplexed by this
statement and what it means.  What am I missing?
Eric Sunshine Aug. 30, 2022, 2:56 a.m. UTC | #6
On Mon, Aug 29, 2022 at 10:53 PM Elijah Newren <newren@gmail.com> wrote:
> On Sun, Aug 28, 2022 at 1:05 PM Junio C Hamano <gitster@pobox.com> wrote:
> > >   t4301: account for behavior differences between sed implementations
> > >   t4031: fix broken &&-chains and add missing loop termination
> > >   t4301: emit blank line in more idiomatic fashion
> >
> > The second one is off by 270.
>
> Apparently Eric knew what you meant, but I'm perplexed by this
> statement and what it means.  What am I missing?

Junio's comment was opaque to me, as well, and it took several minutes
to figure it out (especially since I authored the patches, thus I read
what I expected to read, not what was really there). Taking a look at
just prefixes on the patch subject lines...

    t4301
    t4031
    t4301

there's a transposition in there which, mathematically speaking, makes
one of the test script numbers 270 less than the others.
Elijah Newren Aug. 30, 2022, 2:59 a.m. UTC | #7
On Mon, Aug 29, 2022 at 7:56 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> On Mon, Aug 29, 2022 at 10:53 PM Elijah Newren <newren@gmail.com> wrote:
> > On Sun, Aug 28, 2022 at 1:05 PM Junio C Hamano <gitster@pobox.com> wrote:
> > > >   t4301: account for behavior differences between sed implementations
> > > >   t4031: fix broken &&-chains and add missing loop termination
> > > >   t4301: emit blank line in more idiomatic fashion
> > >
> > > The second one is off by 270.
> >
> > Apparently Eric knew what you meant, but I'm perplexed by this
> > statement and what it means.  What am I missing?
>
> Junio's comment was opaque to me, as well, and it took several minutes
> to figure it out (especially since I authored the patches, thus I read
> what I expected to read, not what was really there). Taking a look at
> just prefixes on the patch subject lines...
>
>     t4301
>     t4031
>     t4301
>
> there's a transposition in there which, mathematically speaking, makes
> one of the test script numbers 270 less than the others.

Ah, gotcha.  Yeah, I totally missed both the digit transposition and
the attempt to highlight it.  Thanks for the explanation.
Johannes Schindelin Aug. 30, 2022, 2:02 p.m. UTC | #8
Hi Elijah & Eric,

On Mon, 29 Aug 2022, Elijah Newren wrote:

> On Sat, Aug 27, 2022 at 10:18 PM Eric Sunshine via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> >
> > This series fixes a failing test in t4301 due to 'sed' behavioral
> > differences between implementations. It also fixes a couple broken &&-chains
> > and adds missing explicit loop termination.
> >
> > The third patch is entirely subjective and can be dropped if unwanted. I
> > spent more than a few minutes puzzling over the script's use of 'printf
> > "\\n"' rather than the more typical 'printf "\n"' or even a simple 'echo',
> > wondering if there was some subtlety I was missing or whether Elijah had
> > encountered an unusual situation in which '\\n' was needed over '\n'. The
> > third patch chooses to replace 'printf "\\n"' with 'echo' which I find more
> > idiomatic, but I can see value in using 'printf "\n"' as perhaps being
> > clearer that it is adding a newline where one is missing.
>
> I can't actually provide the reasoning for it; I took Dscho's testcase
> from [1] and used it as a basis for adding several other testcases.
> When I was copying & pasting and adjusting, I just didn't notice the
> 'printf "\\n"'.  But using a simple echo makes sense.
>
> [1] https://lore.kernel.org/git/3b4ed8bb1bb615277ee51a7b2af5fc53bae0a6e4.1660892256.git.gitgitgadget@gmail.com/

No other reason than that I _seem_ to recall having run into some issues
where _some_ POSIX shell (was it BusyBox' ash?) did not like the
single-escape form "\n".

I have no firm recollection, though, and am fine with converting all of
the double backslashes to single backslashes (read: I am very indifferent
to this issue).

Ciao,
Dscho