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

Re: What's cooking in git.git (Jan 2025, #06; Wed, 22)

From
Jeff King <peff@peff.net>
Date
Feb 3, 2025, 15:33 UTC
Message-ID
<20250203153319.GA4165842@coredump.intra.peff.net>
In-Reply-To
<xmqqwme73ost.fsf@gitster.g>
On Sun, Feb 02, 2025 at 03:33:06PM -0800, Junio C Hamano wrote:
Show 14 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> >> Nice way to use extended context to show why the change makes sense.
> >
> > I've been tempted to support a:
> >
> >   Diff-options: -U10
> >
> > trailer, but that is probably overkill and full of annoying corner
> > cases.
> 
> Do you mean to embed it in the commit log trailer and upon seeing
> it, the log family of commands add it to their setup_revisions()
> invocation, thusly affecting things like "format-patch" and "show"?

Yeah, exactly. Similar to the Best-viewed-with that Ben mentioned (and that name, while clunky, probably shows the intent more).

But...
Show 10 quoted lines
> As a reminder for a patch submitter (i.e., communicated by you who
> wrote the commit to future you who will run format-patch for
> submission), something locally maintained might be sufficient,
> e.g. refs/notes/diffopts that is not shared by default, but still,
> this hint probably wants to be per-path (ideally per-hunk).
> 
> But I think it will make it annoying if you forced those who fetched
> from you to use "-U10" when they do "git show", as the choice would
> be strongly affected by personal preference.  And I certainly do not
> want to see anything less benign than "-U10" silently forced upon me.

Yes, this is my worry, as well. It is nice to suggest to people viewing the diff later that this particular case might benefit from some options. But I don't like the idea of forcing the view on them.

I almost wrote it as:
  Diff-context: 10

which would be more limited. But even that might be annoying in some cases. And it's probably not flexible enough (other things that are likely to be suggested are --color-moved, -w, and --function-context).

Maybe it would be a better feature in an interactive tool like tig, where you could use a key to flip between your normal diff, and the diff as suggested by the commit author. And then the trailer just becomes a micro-format that some tools may respect for the feature. They'd still need to be careful about allowing through arbitrary options to avoid security problems.

-Peff
Previous: Junio C HamanoNext: Eric Sunshine
Message 13 of 20 in “What's cooking in git.git (Jan 2025, #06; Wed, 22)”
  1. Junio C HamanoJan 22, 2025
  2. Jeff KingJan 23, 2025
  3. Junio C HamanoJan 23, 2025
  4. Jeff KingJan 31, 2025
  5. Jeff KingJan 31, 2025
  6. Junio C HamanoJan 31, 2025
  7. Jeff KingFeb 1, 2025
  8. Junio C HamanoFeb 2, 2025
  9. Junio C HamanoFeb 3, 2025
  10. Jeff KingFeb 4, 2025
  11. D. Ben KnobleFeb 2, 2025
  12. Junio C HamanoFeb 2, 2025
  13. Jeff KingFeb 3, 2025
  14. Eric SunshineJan 23, 2025
  15. Junio C HamanoJan 23, 2025
  16. Taylor BlauJan 23, 2025
  17. Patrick SteinhardtJan 24, 2025
  18. Toon ClaesJan 24, 2025
  19. Junio C HamanoJan 24, 2025
  20. Junio C HamanoJan 24, 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.