From: "Jean-Noël AVILA" <avila.jn@gmail.com>
To: git@vger.kernel.org, Tian Yuchen <cat@malon.dev>
Cc: gitster@pobox.com, Tian Yuchen <cat@malon.dev>
Subject: Re: [PATCH v1] diff: document -U without <n> as using default context
Date: Tue, 10 Mar 2026 18:31:14 +0100 [thread overview]
Message-ID: <5973423.DvuYhMxLoT@piment-oiseau> (raw)
In-Reply-To: <20260309172719.125419-1-cat@malon.dev>
On Monday, 9 March 2026 18:27:19 CET Tian Yuchen wrote:
> The documentation for '-U<n>' implies that the numeric value '<n>' is
> mandatory. However, the command line parser has historically accepted
> '-U' without a number.
>
> Strictly requiring a number for '-U' would break existing tests
> (e.g., in 't4013') and likely disrupt user scripts relying on this
> undocumented behavior.
>
> Since we are retaining this fallback behavior for backward compatibility,
> update the documentation to explicitly state that '<n>' can be omitted
> for the short option '-U'.
In this case, isn't the long option also changed to optional number, such as:
`--unified[=<n>]`
?
>
> Signed-off-by: Tian Yuchen <cat@malon.dev>
> ---
> Documentation/diff-context-options.adoc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/diff-context-options.adoc
> b/Documentation/diff-context-options.adoc index e161260358..655496ec3a
100644
> --- a/Documentation/diff-context-options.adoc
> +++ b/Documentation/diff-context-options.adoc
> @@ -1,4 +1,4 @@
> -`-U<n>`::
> +`-U[<n>]`::
> `--unified=<n>`::
> Generate diffs with _<n>_ lines of context. Defaults to
`diff.context`
> or 3 if the config option is unset.
next prev parent reply other threads:[~2026-03-10 17:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 23:10 An annoying "Bug" that we would probably leave as-is Junio C Hamano
2026-03-09 17:10 ` Tian Yuchen
2026-03-09 17:27 ` [PATCH v1] diff: document -U without <n> as using default context Tian Yuchen
2026-03-09 22:00 ` D. Ben Knoble
2026-03-10 4:55 ` Tian Yuchen
2026-03-09 22:17 ` Junio C Hamano
2026-03-10 4:51 ` Tian Yuchen
2026-03-10 5:30 ` [PATCH v2] " Tian Yuchen
2026-03-10 9:15 ` Oswald Buddenhagen
2026-03-10 9:43 ` Tian Yuchen
2026-03-10 13:14 ` Junio C Hamano
2026-03-10 9:50 ` [PATCH v3] " Tian Yuchen
2026-03-10 17:31 ` Jean-Noël AVILA [this message]
2026-03-11 4:33 ` [PATCH v1] " Tian Yuchen
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=5973423.DvuYhMxLoT@piment-oiseau \
--to=avila.jn@gmail.com \
--cc=cat@malon.dev \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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