From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, Sergey Organov <sorganov@gmail.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
git@vger.kernel.org, Matthieu Moy <matthieu.moy@univ-lyon1.fr>
Subject: Re: Can we clarify the purpose of `git diff -s`?
Date: Thu, 11 May 2023 12:17:06 -0600 [thread overview]
Message-ID: <645d3122bd1d2_26011a2947a@chronos.notmuch> (raw)
In-Reply-To: <xmqqwn1ewyzx.fsf@gitster.g>
Junio C Hamano wrote:
> Sergey Organov <sorganov@gmail.com> writes:
>
> > I entirely agree with your conclusion: obviously, -s (--silent) and
> > --no-patch are to be different for UI to be even remotely intuitive, and
> > I'd vote for immediate fix of --no-patch semantics even though it's a
> > backward-incompatible change.
> While it is very clear that the intent of the author was to make it
> a synonym for "-s" and not a "feature-wise enable/disable" option,
I disgree, it's very clear the intention was to negate --patch, he
explicitely said so multiple times:
* This follows the usual convention of having a --no-foo option to
negate --foo.
* to cancel the effect of `--patch`.
In particular, the purpose was to make silencing the output of `git diff`
more accessible, the cover letter makes it abundantly clear [1]:
====
> Stefan Beller <stefanbeller@googlemail.com> writes:
>
>> However I sometimes also get:
>> sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53
>> Fri Jul 12 10:49:34 2013 -0700
>>
>> diff --git a/Documentation/RelNotes/1.8.4.txt
>> b/Documentation/RelNotes/1.8.4.txt
>> index 0e50df8..4250e5a 100644
>> --- a/Documentation/RelNotes/1.8.4.txt
>> +++ b/Documentation/RelNotes/1.8.4.txt
>
> "git show" will show the diff by default. For merge commits, it shows
> the --cc diff which is often empty, hence the behavior you see.
>
> You want to use "git show -s", which suppresses the patch output.
... and this "git show -s" is extraordinarily hard to discover, as it
is only documented in "git log --help". Google has been my friend
here, but we should really improve that.
This patch series does essentially two things:
* Add a --no-patch synonym for -s. I'm actually wondering why the
option wasn't called this way from the beginning.
* Reorganize the doc so that "git show" actually mentions it.
====
Making it a synonym of `-s` was a means, not an end.
> I do not think it will break established use cases too badly to fix
> the behaviour of "-s" so that it does not get stuck. We saw an
> existing breakage in one test,
It's curious that your patch breaks one test case, while my approach
breaks *zero* cases.
> but asking the owners of scripts that make the same mistake of
> assuming "-s" gets stuck for some but not other options to fix that
> assumption based on an earlier faulty implementation is much easier.
"The users are using the interface wrong" is an euphemism for "I want to
break backwards-compatibility".
According to Linus Torvalds if your users are relying on a bug in your
interface, that bug is now a feature.
If we want to break backwards-compatibility then let's do so.
> So, no, I do not think we can immediately "fix". I do not think
> anybody knows if it can be done "immediately" or needs a careful
> planning to transition, and I offhand do not know if it is even
> possible to transition without fallout.
I know it can be done immediately, because my patch series already did
it.
[1] https://lore.kernel.org/git/1373893639-13413-1-git-send-email-Matthieu.Moy@imag.fr/
--
Felipe Contreras
next prev parent reply other threads:[~2023-05-11 18:17 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-11 3:14 Can we clarify the purpose of `git diff -s`? Felipe Contreras
2023-05-11 11:59 ` Sergey Organov
2023-05-11 16:26 ` Junio C Hamano
2023-05-11 17:37 ` Junio C Hamano
2023-05-11 18:04 ` Sergey Organov
2023-05-11 18:27 ` Junio C Hamano
2023-05-11 18:36 ` Felipe Contreras
2023-05-11 18:17 ` Felipe Contreras [this message]
2023-05-11 17:41 ` Felipe Contreras
2023-05-11 18:31 ` Sergey Organov
2023-05-11 19:10 ` Felipe Contreras
2023-05-11 19:32 ` Sergey Organov
2023-05-11 19:54 ` Felipe Contreras
2023-05-11 20:24 ` Sergey Organov
2023-05-11 20:59 ` Felipe Contreras
2023-05-11 22:49 ` Sergey Organov
2023-05-11 23:28 ` Felipe Contreras
2023-05-12 8:40 ` Sergey Organov
2023-05-12 19:19 ` Felipe Contreras
[not found] ` <5bb24e0208dd4a8ca5f6697d578f3ae0@SAMBXP02.univ-lyon1.fr>
2023-05-12 8:15 ` Matthieu Moy
2023-05-12 17:03 ` Junio C Hamano
2023-05-12 18:21 ` Sergey Organov
2023-05-12 19:21 ` Junio C Hamano
2023-05-12 19:34 ` Junio C Hamano
2023-05-12 20:28 ` Felipe Contreras
2023-05-12 20:47 ` Junio C Hamano
2023-05-12 21:01 ` Felipe Contreras
2023-05-12 21:47 ` Junio C Hamano
2023-05-12 21:48 ` Junio C Hamano
2023-05-12 23:21 ` Felipe Contreras
2023-05-12 21:41 ` Sergey Organov
2023-05-12 22:17 ` Junio C Hamano
2023-05-12 22:47 ` Sergey Organov
2023-05-12 23:07 ` Felipe Contreras
2023-05-13 14:58 ` Philip Oakley
2023-05-13 17:45 ` Sergey Organov
2023-05-12 19:47 ` Felipe Contreras
2023-05-12 19:34 ` Felipe Contreras
2023-05-12 19:17 ` Felipe Contreras
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=645d3122bd1d2_26011a2947a@chronos.notmuch \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=matthieu.moy@univ-lyon1.fr \
--cc=sorganov@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).