Re: [PATCH] commit: Avoid redundant scissor line with --cleanup=scissors -v
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 27, 2024, 17:10 UTC
- Message-ID
- <xmqqedcxvnn8.fsf@gitster.g>
- In-Reply-To
- <Zd2eLxPelxvP8FDk@localhost>
Josh Triplett <josh@joshtriplett.org> writes:
Show 5 quoted lines
> I could add statefulness to wt_status_add_cut_line instead, on the > assumption that it's the only thing that should be adding a cut line, > and having it not add the line if previously added. For instance, it > could accept a pointer to the full wt_status rather than just the fp, > and keep a boolean state there.
Yeah, that approach also has to assume that wt_status structure is used only once to create a single message buffer without being reused, but I think that is a safe assumption, too. The function being the only thing that adds the scissors line should also be a safe assumption in code hygiene standpoint---if somebody else tries to manually write such a line, we'll shoot such a patch down and tell them to call this function anyway ;-).
> I did run the testsuite, and it passed. I can add a simple test easily > enough.
It would be prudent to do so.
Thanks.