All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shourya Shukla <shouryashukla.oo@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: chrisitan.couder@gmail.com, liu.denton@gmail.com, git@vger.kernel.org
Subject: Re: [PATCH v4] submodule: port subcommand 'set-url' from shell to C
Date: Fri, 8 May 2020 11:17:28 +0530	[thread overview]
Message-ID: <20200508054728.GA8615@konoha> (raw)
In-Reply-To: <xmqqv9l849i4.fsf@gitster.c.googlers.com>

On 06/05 10:08, Junio C Hamano wrote:
> Shourya Shukla <shouryashukla.oo@gmail.com> writes:
> 
> > No worries. BTW, should I include the `path == NULL` check in the
> > if-statement?
> 
> If I were writing this code, I would probably write it like so:
> 
> 	if (!path || !newurl)
> 		oops;
> 
> Specifically, I would write "!path", not "path == NULL".  I thought
> a rule for that is in the CodingGuidelines (I didn't double check,
> though).

I could not find a rule like that in the CodingGuidelines.
Should I add it?
https://github.com/git/git/blob/master/Documentation/CodingGuidelines

> The comparison on argc is to see if we are even allowed to access
> argv[0] and/or argv[1].  In practice, if what main() got from the
> outside world in argv[] is passed directly to you, argv[n] would
> never be NULL as long as n < argc, but there are a few levels of
> callchain between main() and you (i.e. module_set_url()), so not
> counting on that would be sensible.

Understood. I will add the NULL check as well.

  reply	other threads:[~2020-05-08  5:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  7:37 [PATCH v4] submodule: port subcommand 'set-url' from shell to C Shourya Shukla
2020-05-06  8:09 ` Christian Couder
2020-05-06 16:31   ` Shourya Shukla
2020-05-06 17:16     ` Junio C Hamano
2020-05-06 17:12 ` Junio C Hamano
2020-05-06 18:12   ` Shourya Shukla
2020-05-06 18:22     ` Junio C Hamano
2020-05-07  4:40       ` Shourya Shukla
2020-05-07  5:08         ` Junio C Hamano
2020-05-08  5:47           ` Shourya Shukla [this message]
2020-05-08  6:18             ` Christian Couder
2020-05-08 15:18               ` Re* " Junio C Hamano
2020-05-08 15:38                 ` Eric Sunshine
2020-05-08 15:57                   ` Junio C Hamano
2020-05-08 16:13                     ` Eric Sunshine
2020-05-08 16:38                       ` Junio C Hamano
2020-05-08 17:51                         ` Eric Sunshine
2020-05-08  6:21 ` [PATCH v5] " Shourya Shukla
2020-05-08  6:30   ` Denton Liu
2020-05-08 16:13     ` Junio C Hamano
2020-05-08 16:17     ` Junio C Hamano
2020-05-08 16:18   ` [PATCH v6] " Junio C Hamano

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=20200508054728.GA8615@konoha \
    --to=shouryashukla.oo@gmail.com \
    --cc=chrisitan.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=liu.denton@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 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.