public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail•com>
To: Jeff King <peff@peff•net>, Leon Michalak <leonmichalak6@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: Discussion for interactive --patch commands to get --unified support
Date: Fri, 2 May 2025 15:33:01 +0100	[thread overview]
Message-ID: <3e38b7b4-eb6e-4af5-a5f6-f0d7ca4d32d6@gmail.com> (raw)
In-Reply-To: <20250429220933.GC36727@coredump.intra.peff.net>

Hi Leon and Jeff

On 29/04/2025 23:09, Jeff King wrote:
> On Tue, Apr 29, 2025 at 10:16:15AM +0100, Leon Michalak wrote:
> 
>> - 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 that would be a good place to start and would be a useful 
improvement on the status quo. To implement it one can copy what we do 
to respect diff.algorithm. I'm not sure it is worth the effort to 
support `git add -p -U <context>`. Being able to interactively change 
the context as suggested elsewhere sounds more interesting to me but it 
would be more work to implement as we'd have to regenerate the diff each 
time.

Best Wishes

Phillip

> 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.
> 


  parent reply	other threads:[~2025-05-02 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29  9:16 Discussion for interactive --patch commands to get --unified support Leon Michalak
2025-04-29 16:48 ` Junio C Hamano
2025-04-29 22:09 ` Jeff King
2025-04-30  8:04   ` Leon Michalak
2025-04-30 14:40     ` Junio C Hamano
2025-05-02 14:33   ` Phillip Wood [this message]
2025-05-02 14:39 ` Phillip Wood
2025-05-02 16:14   ` Leon Michalak
2025-05-02 16:23     ` Leon Michalak
2025-05-02 16:57     ` Junio C Hamano
2025-05-02 17:13       ` Leon Michalak
2025-05-02 18:36         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e38b7b4-eb6e-4af5-a5f6-f0d7ca4d32d6@gmail.com \
    --to=phillip.wood123@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=leonmichalak6@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=phillip.wood@dunelm$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox