Re: [PATCH v3 0/6] use the pager in 'add -p'
- From
- Dragan Simic <dsimic@manjaro.org>
- Date
- Jun 8, 2024, 05:54 UTC
- Message-ID
- <a8d3415e3913e3a0798a748ed7f7a093@manjaro.org>
- In-Reply-To
- <6056d585-6380-43e7-adf1-9f9aadd2a7db@gmail.com>
On 2024-06-05 15:21, Phillip Wood wrote:
Show 22 quoted lines
> 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.
[1] https://lore.kernel.org/git/844704794168f9fcb85c75014c84cde0@manjaro.org/