Re: Can we clarify the purpose of `git diff -s`?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:
> Sergey Organov <sorganov@xxxxxxxxx> 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@xxxxxxxxxxxxxx> 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@xxxxxxx/

-- 
Felipe Contreras



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux