From: Tian Yuchen <cat@malon.dev>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v1] diff: document -U without <n> as using default context
Date: Tue, 10 Mar 2026 12:51:23 +0800 [thread overview]
Message-ID: <71287f25-eb60-4a45-b4ac-9368053c9183@malon.dev> (raw)
In-Reply-To: <xmqqwlzk1wd8.fsf@gitster.g>
Hi Junio,
> I am moderately nagative.
>
> It is not like we are _encouraging_ users to omit <n> from -U<n>,
> but it is not errored out only due to a bug. Who would the new text
> help? Users would wonder why <n> is not optional in --unified=<n>,
> the other way to spell the same thing.
Indeed.
What I was actually thinking earlier was: for bugs like this, which most
likely come from misoperations, typos, or inconsistencies from *ancient*
standards, should we acknowledge them as
“yes it is a bug/historical issue”
or
“*special behavior* we defined”?
I'm not as familiar with the Git codebase as you are, so I couldn't make
a definitive call. I chose the second approach, but I now agree the
first makes more sense. In other words, users shouldn't be *encouraged*
to engage in such behavior, right?
> If we want to be explicit, we should probably do this instead:
>
> `-U<n>`::
> `--unified=<n>`::
> Generate diffs with _<n>_ lines of context. Defaults to `diff.context`
> or 3 if the config option is unset (`-U` without '<n>' is accepted
> as a silent synonym for `-p` due to a historical accident).
>
> which would tell readers what happens when '<n>' is omitted and why
> we allow such an inconsistency.
That makes sense. I'll make the changes accordingly.
Regards,
Yuchen
next prev parent reply other threads:[~2026-03-10 4:51 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 [this message]
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 ` [PATCH v1] " Jean-Noël AVILA
2026-03-11 4:33 ` 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=71287f25-eb60-4a45-b4ac-9368053c9183@malon.dev \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.