git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: George KingNext: Jeff King
Message 9 of 10 in “Difficulty with parsing colorized diff output”
  1. George KingDec 8, 2018
  2. Jeff KingDec 8, 2018
  3. Stefan BellerDec 11, 2018
  4. Jeff KingDec 11, 2018
  5. George KingDec 11, 2018
  6. Ævar Arnfjörð BjarmasonDec 11, 2018
  7. George KingDec 11, 2018
  8. George KingDec 11, 2018
  9. Jeff KingDec 12, 2018
  10. Jeff KingDec 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.