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

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

From
Leon Michalak <leonmichalak6@gmail.com>
Date
May 2, 2025, 17:13 UTC
Message-ID
<CAP9jKjEbb_ABmGmLNwn=ruh+BOR73QDqtzF-cCYv40cE47fEGQ@mail.gmail.com>
In-Reply-To
<xmqqfrhnuf06.fsf@gitster.g>

This is what I have been using currently although the perfectionist in me says that a user could pass `--unified=-1` and the code would treat that as if nothing was passed by the user.

In practice, I guess this doesn't really matter. I think that was probably a needed sanity check, thanks

On Fri, 2 May 2025, 17:57 Junio C Hamano, <gitster@pobox.com> wrote:
Show 24 quoted lines
>
> Leon Michalak <leonmichalak6@gmail.com> writes:
>
> > Inheriting the diff.context setting is what scratches my itch the most, although
> > also being able to set the context in the command list of `add -i`
> > sounds interesting too. Personally, I don't think I would use the
> > command line overrides too much myself as most of the time (like with
> > diff) I'd like to set the option and forget it but it does have a
> > certain consistency to it.
>
> Sounds good.
>
> > Slightly off-topic to the discussion, but does anyone have advice on
> > how to deal with providing a sentinel value for something like
> > context?
>
> Seeing in diff.c
>
>     static int diff_context_default = 3;
>     static int diff_interhunk_context_default;
>
> that they are of signed type, and negative context would not make
> sense (would it???), wouldn't -1 be a good "they haven't touched
> this from the command line or configuration" value?
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 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.