git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Atharva Raykar <raykar.ath@gmail.com>,
	Shourya Shukla <shouryashukla.oo@gmail.com>
Subject: Re: [PATCH 1/2] submodule--helper: remove an unreachable call to usage_with_options
Date: Mon, 21 Jun 2021 15:58:00 -0400	[thread overview]
Message-ID: <CAPig+cT66BT7fCfHBJM25D1SBVKAwRpSh+SAaR8YmqZX+7epvA@mail.gmail.com> (raw)
In-Reply-To: <20210621190837.9487-2-kaartic.sivaraam@gmail.com>

On Mon, Jun 21, 2021 at 3:09 PM Kaartic Sivaraam
<kaartic.sivaraam@gmail.com> wrote:
> The code path in question calls `error` in a particular case.
> But, `error` never returns as it exits directly. This makes
> the call to `usage_with_options` that follows the `error` call
> unreachable.

error() returns -1; you will commonly see:

    if (check_something())
        return error(...);

> So, remove the unreachable `usage_with_options` call.
>
> Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
> ---
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> @@ -1637,8 +1637,6 @@ static int module_deinit(int argc, const char **argv, const char *prefix)
>         if (all && argc) {
>                 error("pathspec and --all are incompatible");
> -               usage_with_options(git_submodule_helper_usage,
> -                                  module_deinit_options);
>         }

usage_with_options(), on the other hand, exits directly.

  reply	other threads:[~2021-06-21 19:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 19:08 [PATCH 0/2] Some submodule related code cleanup Kaartic Sivaraam
2021-06-21 19:08 ` [PATCH 1/2] submodule--helper: remove an unreachable call to usage_with_options Kaartic Sivaraam
2021-06-21 19:58   ` Eric Sunshine [this message]
2021-06-22 18:02     ` Kaartic Sivaraam
2021-06-21 19:08 ` [PATCH 2/2] submodule: remove unnecessary `prefix` based option logic Kaartic Sivaraam
2021-06-22 18:14 ` [PATCH v2 0/1] Some submodule related code cleanup Kaartic Sivaraam
2021-06-22 18:14   ` [PATCH v2 1/1] submodule: remove unnecessary `prefix` based option logic Kaartic Sivaraam

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=CAPig+cT66BT7fCfHBJM25D1SBVKAwRpSh+SAaR8YmqZX+7epvA@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=raykar.ath@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.
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 NNTP newsgroup(s).