Subject: Re: [PATCH v3 03/10] trailer: unify trailer formatting machinery

From: Linus Arver <[email-masked]>
Date: Thu, 01 Feb 2024 23:23:33 -0800

Junio C Hamano <[email-masked]> writes:

> Linus Arver <[email-masked]> writes:
>
>> I am planning to spend today trying to break up this patch into smaller
>> preparatory chunks that still end up at the same state as this patch.
>>
>> Will post another update on how this goes by EOD. Thanks.

I'm happy to report that this breaking-up of things is going a lot
smoother than expected. The hard part is not so much the rearranging of
code but rather thinking up of good commit messages to explain the
intent of each smaller step. I have most of this patch broken up into
much smaller steps with all tests passing.

> I stopped reading the function after noticing the double unfolding,
> so there may be similar "why do we do this unexplained new thing in
> the function that the original didn't?" issues in the "same state",

Yep, and these unexplained new things are the things I am recalling
(from a few weeks back when I first started this series) and am now
trying to find the right commit messages for.

> In any case, if I understood your plan I heard from you in the
> discussion yesterday correctly, the unfolding should not be added to
> format (to make it double),

Yes, it will be done during parsing for now. This is because of
additional refactors that are coming in the later series, which ...

> but would be moved from parse to format
> in a single step.  It would avoid making it double, and would make
> the parse step about purely parsing without modification, which is a
> very worthwhile thing to do.

... achieve this exact thing (unfolding is done "lazily" during
formatting only, not "eagerly" as we do now during parsing).

> So I am not sure if we want to end up
> with the same state in the first place, though.
>
> THanks.

So far the breaking-up of this patch has not revealed a need to change
the end result significantly from what I have here. But I admit I am not
sure this will be the case for the other patches that need similar
treatment in this series.

Considering how it took me most of the day to break up this single
patch, I am not sure I can get a v4 ready by tomorrow. Might need a few
days for that.

Thank you for your very helpful review comments for this series so far.
They have been quite illuminating. :)