Re: Difficulty with parsing colorized diff output
- From
Jeff King <peff@peff.net>
- Date
- Dec 12, 2018, 13:52 UTC
- Message-ID
- <20181212135255.GA5768@sigill.intra.peff.net>
- In-Reply-To
- <A97DD550-BE35-43BA-A181-708B7D065F3F@gmail.com>
On Tue, Dec 11, 2018 at 01:55:09PM -0500, George King wrote:
> I just noticed that while `wsErrorHighlight = none` fixes the problem > of extra green codes for regular diff, it fails to have any effect > during interactive `git add -p`.
This is due to the way add--interactive invokes diff. It uses the plumbing commands (diff-tree, diff-files, etc), which do not respect config which changes the output (since their purpose is to provide stable machine-readable output).
But add--interactive does a slightly funny thing: it runs each diff twice. Once to get the machine-readable version, and once to get a colorized version which it shows to the user. When it does the latter, it has to manually enable other options (e.g., passing --color as appropriate, or passing along diff.algorithm).
So the matching behavior here would be for it to look as wsErrorHighlight and pass it along as a command line option.
-Peff