Re: [PATCH] pretty: fix lost and leaked colors at line breaks
- From
Andy Koppe <andy.koppe@gmail.com>
- Date
- Nov 17, 2026, 00:12 UTC
- Message-ID
- <CAHWeT-Z=pKMtGN7GU-UP_yrygTsihn-cwYoLPzjo9=3J_SjJ8Q@mail.gmail.com>
- In-Reply-To
- <xmqq4idgn3py.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> And custom format writers have no way to control what happens at the > (artificial) line boundary that wrapping at 72 columns %w(72) > introduces, %b may include many lines but there is nothing for them > to say "at the end of each and every line, do this". And that is > why you decided that runtime detection is the only way to do this to > help custom formats?
Yes, exactly. I've tried to make that clearer in the commit message of v2.
> > The same can happen to > > lines picked out by grepping colored output. > > I am not sure if that is a problem.
Fair enough. It's a minor point, so I've dropped it.
> > Secondly, colors that are still active at the end of a line can leak > > into what follows. > > That somehow feels contradictory with the previous point, though.
You're right, I didn't put that well. The graph doesn't reset colors at the start of a line, but after each of its colored edges. So a color carried across a line break is lost once an edge has been drawn, but it leaks into anything drawn before that, notably the uncolored '*' commit marker. Attributes such as bold even leak into the edges themselves, as their colors only replace the foreground color. v2 rewords this.
Thanks, Andy