git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Shourya Shukla <shouryashukla.oo@gmail.com>
Cc: Christian Couder <christian.couder@gmail.com>,
	Kaartic Sivaraam <kaartic.sivaraam@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Denton Liu <liu.denton@gmail.com>, Git List <git@vger.kernel.org>,
	Doan Tran Cong Danh <congdanhqx@gmail.com>
Subject: Re: [PATCH v2] submodule: port subcommand 'set-branch' from shell to C
Date: Wed, 20 May 2020 10:45:53 -0400	[thread overview]
Message-ID: <CAPig+cSr0_eOOi6xiOLY0bzJ33ewpib+MiMjmtay_bi4J9D_=w@mail.gmail.com> (raw)
In-Reply-To: <20200520121530.GA7992@konoha>

On Wed, May 20, 2020 at 8:23 AM Shourya Shukla
<shouryashukla.oo@gmail.com> wrote:
> On 19/05 02:57, Eric Sunshine wrote:
> > On Tue, May 19, 2020 at 2:27 PM Shourya Shukla
> > <shouryashukla.oo@gmail.com> wrote:
> > > +        OPT__QUIET(&quiet,
> >
> > However, the bigger question is: Why is the --quiet option even here?
> > None of the code in this function ever consults the 'quiet' variable,
> > so its presence seems pointless.
>
> I actually wanted to have *some* use of the `quiet` option and delivered
> it in the v1, but after some feedback had to scrap it. You may have a
> look here:
> https://lore.kernel.org/git/20200513201737.55778-2-shouryashukla.oo@gmail.com/

I agree with Denton's conclusion about not introducing needless noise
merely to give the --quiet option something to squelch. And, to answer
your question about when and when not to print something, a good "Unix
way" guideline is that "silence is golden"[1].

[1]: http://www.catb.org/esr/writings/taoup/html/ch01s06.html#id2878450

> > Looking at the git-submodule documentation, I see that it is already
> > documented as accepted --quiet, so it may make some sense for you to
> > accept the option here. However, it might be a good idea either to
> > have an in-code comment or a blurb in the commit message explaining
> > that this C rewrite accepts the option for backward-compatibility (and
> > for future extension), not because it is actually used presently.
>
> That seems like a better idea; should I add this comment just above the
> `options` array? BTW, the shell version has a comment about this,
> see:
> https://github.com/git/git/blob/v2.26.2/git-submodule.sh#L727

It would be a good idea to attach a comment like that to the
declaration of 'quiet' in the C code (rather than placing it above the
'options' array). For instance:

    /* for backward compatibility but not presently used */
    int quiet = 0;

> > > +        die(_("--branch and --default do not make sense together"));
> >
> > A more precise way to say this is:
> >
> >   die(_("--branch and --default are mutually exclusive"));
>
> Will that be clear to everyone? What I mean is maybe a person from a
> non-mathematical background (someone doing programming as a hobby maybe)
> will not grasp at this at one go and will have to search it's meaning
> online. Isn't it fine as-is?

Others have already responded to this up-thread...

      parent reply	other threads:[~2020-05-20 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 18:26 [PATCH v2] submodule: port subcommand 'set-branch' from shell to C Shourya Shukla
2020-05-19 18:57 ` Eric Sunshine
2020-05-20 12:15   ` Shourya Shukla
2020-05-20 13:12     ` Kaartic Sivaraam
2020-05-20 14:37       ` Junio C Hamano
2020-05-20 14:45     ` Eric Sunshine [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPig+cSr0_eOOi6xiOLY0bzJ33ewpib+MiMjmtay_bi4J9D_=w@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=christian.couder@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=liu.denton@gmail.com \
    --cc=shouryashukla.oo@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).