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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 02, 2025 at 03:33:06PM -0800, Junio C Hamano wrote:

> Jeff King <peff@xxxxxxxx> 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...

> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux