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

Re: Discussion for interactive --patch commands to get --unified support

From
Jeff King <peff@peff.net>
Date
Apr 29, 2025, 22:09 UTC
Message-ID
<20250429220933.GC36727@coredump.intra.peff.net>
In-Reply-To
<CAP9jKjGb-Rcr=RLJEzeFdtrekYM+qmHy+1T1fykU3n9cV4GhGw@mail.gmail.com>
On Tue, Apr 29, 2025 at 10:16:15AM +0100, Leon Michalak wrote:
Show 6 quoted lines
> - make `diff.context` setting extend to the interactive patch commands
> (not sure how a change like this would be welcomed considering it
> could change users command outputs seemingly out of nowhere)
> - add an `interactive.context` setting that would work like the
> existing `diff.context` setting but apply only to the interactive
> patch commands

In my opinion it would be fine to respect diff.context (and probably diff.interhunkcontext[1]) by default. Though it does change the command output, the interactive output is by definition user-facing, so we shouldn't be breaking scripts. And we already respect other porcelain level config like colorizing.

I think the only reason we don't already do so is that the interactive code is built around the plumbing commands, which conservatively avoid various config options. So the calling code has to explicitly check the config itself.

-Peff
[1] Looking at git_diff_ui_config(), which are all the options read by
    porcelain git-diff but not by plumbing git-diff-files, etc, there
    may be other config in the same boat. E.g., I'd guess that people
    with diff.colormoved set would appreciate seeing that effect in the
    colorized versions we show. But I think it is OK to just consider
    diff.context for now, and see if anybody ever cares enough about
    other options to look into them.
Previous: Junio C HamanoNext: Leon Michalak
Message 3 of 12 in “Discussion for interactive --patch commands to get --unified support”
  1. Leon MichalakApr 29, 2025
  2. Junio C HamanoApr 29, 2025
  3. Jeff KingApr 29, 2025
  4. Leon MichalakApr 30, 2025
  5. Junio C HamanoApr 30, 2025
  6. Phillip WoodMay 2, 2025
  7. Phillip WoodMay 2, 2025
  8. Leon MichalakMay 2, 2025
  9. Leon MichalakMay 2, 2025
  10. Junio C HamanoMay 2, 2025
  11. Leon MichalakMay 2, 2025
  12. Junio C HamanoMay 2, 2025

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.