Re: [PATCH v3 0/6] use the pager in 'add -p'
- From
- phillip.wood123@gmail.com <phillip.wood123@gmail.com>
- Date
- Jun 9, 2024, 14:29 UTC
- Message-ID
- <a2a59f5e-fd55-41d3-8472-b99256e1f428@gmail.com>
- In-Reply-To
- <a8d3415e3913e3a0798a748ed7f7a093@manjaro.org>
Hi Dragan
On 08/06/2024 06:54, Dragan Simic wrote:
Show 27 quoted lines
> On 2024-06-05 15:21, Phillip Wood wrote: >> On 05/06/2024 10:09, Jeff King wrote: >>> On Tue, Jun 04, 2024 at 08:32:04AM -0700, Junio C Hamano wrote: >>> >>> Given that the main use case for "|" is for human viewing through a >>> pager, I think the colorful, filtered version meant for users is the >>> best default. And then the "bare" version can come from an alternate >>> command or a knob. >> >> I think that's a very good point. It is hard to see what "|" can be >> used for other than viewing the hunk as (a) git does not read the >> output so it cannot be used to filter or edit the hunk that is applied >> and (b) we pass an isolated hunk so the post-image offset in the hunk >> header is likely to be wrong and there is no indication as to which >> file it comes from so the program being run cannot apply the hunk >> itself. Having the escape codes does make it harder to filter the >> hunk. For example to just look at the post-image as one needs to do >> something like >> >> grep '^[^-+ @]*[+ @]' >> >> instead of just using '^[+ @]' as the pattern but the bonus is that >> the output is colored. > > Agreed, but as I already explained, [1] only when using the bare "|" > command. When "|xyz" is used instead, the version of the hunk with > no coloring escape sequences should be piped to xyz.
Having read the message you referenced I'm struggling to understand the use-case for stripping escape codes - what do you want to do with the hunk that means you want to remove the color?
Best Wishes
Phillip
> > [1] > https://lore.kernel.org/git/844704794168f9fcb85c75014c84cde0@manjaro.org/