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

From: Felipe Contreras <[email-masked]>
Date: Thu, 11 May 2023 11:41:53 -0600

Sergey Organov wrote:

> I'd rather think about generic interface for setting/clearing (multiple)
> bits through CI than resorting to such convenience tricks. Once that is
> in place, one will be able to say "I need these bits only", "I need to
> turn these bit(s) on", and "I need to turn these bit(s) off"
> conveniently and universally in any part of Git CI where it's needed.

It's possible to achieve both.

Imagine your ideal explicit interface. In that interface the default is no
output, so you *have* to specify all the bits, for example:

  git show --patch

Or:

  git show --raw

In this ideal interface it's clear what the user wants to do, because it's
explicit.

  git show --patch --raw --no-patch

Agreed?

My proposal achieves your ideal explicit interface, except when no format is
specified (e.g. `git show`), a default format is chosen for the user, but
that's *only* if the user hasn't specified any format.

If you explicitely specify the output format that you want, then the default is
irrelevant to you, thus you have your ideal explicit interface.

This is the best of both worlds.

Cheers.

-- 
Felipe Contreras