Re: [PATCH v3 0/6] use the pager in 'add -p'
- From
- Dragan Simic <dsimic@manjaro.org>
- Date
- Jun 10, 2024, 09:09 UTC
- Message-ID
- <bed3ddc6e330c67fb127c045ee4530ba@manjaro.org>
- In-Reply-To
- <1ae0715d-df76-4019-995e-f00f3506f2ac@gmail.com>
Hello Phillip,
On 2024-06-10 10:27, Phillip Wood wrote:
Show 20 quoted lines
> On 09/06/2024 18:20, Dragan Simic wrote: >> On 2024-06-09 16:29, phillip.wood123@gmail.com wrote: >> >>> 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? >> >> Let me recap, please. >> [...] >> I hope this makes the whole thing more clear. > > It is very clear _how_ you think it should work and I agree that makes > sense in the context of a generic shell pipeline. What's not clear to > me is _why_ that is useful in the context of displaying hunks in "git > add -p". The purpose of "git add -p" is to allow the user to > interactively stage individual hunks. The "|" command allows the user > to display the hunk in a way that helps them decide whether to stage > that particular hunk. Are you able to give a specific example of a > command that would help you decide whether to stage a particular hunk > where you would not want to keep the escape codes?
Well, it isn't about not _wanting_ to keep the coloring escape sequences, but about the _need_ to play it safe, so to speak. In other words, we can't know that a random "xyz", as in "|xyz", can actually handle the coloring escape sequences, so we need to be on the safe side and protect the users from being hit by garbled outputs.
That's why it would be the best to have "P", "|xyz" and ">xyz" as the different "git add -p" options (piped to the configured pager with preserved escape sequences, piped to "xyz" with stripped escape sequences, and piped to "xyz" with preserved escape sequences, respectively), as I proposed earlier.