All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: kumbayo84@arcor.de, pc44800@gmail.com,
	Stefan Beller <sbeller@google.com>
Subject: [PATCH] submodule deinit: handle non existing pathspecs gracefully
Date: Tue, 27 Mar 2018 16:28:24 -0700	[thread overview]
Message-ID: <20180327232824.112539-1-sbeller@google.com> (raw)
In-Reply-To: <CAGZ79kYGY5bjh0WPQh7xkXQxLkB9EQ-OcJhVuGE8YUnwmvk2Fg@mail.gmail.com>

This fixes a regression introduced in 22e612731b5 (submodule: port
submodule subcommand 'deinit' from shell to C, 2018-01-15), when handling
pathspecs that do not exist gracefully. This restores the historic behavior
of reporting the pathspec as unknown and returning instead of reporting a
bug.

Reported-by: Peter Oberndorfer <kumbayo84@arcor.de>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/submodule--helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index ee020d4749..6ba8587b6d 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1042,7 +1042,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)
 		die(_("Use '--all' if you really want to deinitialize all submodules"));
 
 	if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
-		BUG("module_list_compute should not choke on empty pathspec");
+		return 1;
 
 	info.prefix = prefix;
 	if (quiet)
-- 
2.17.0.rc1.321.gba9d0f2565-goog


  reply	other threads:[~2018-03-27 23:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 19:48 git submodule deinit resulting in BUG: builtin/submodule--helper.c:1045: module_list_compute should not choke on empty pathspec Peter Oberndorfer
2018-03-27 22:56 ` Stefan Beller
2018-03-27 23:28   ` Stefan Beller [this message]
2018-03-28  4:09     ` [PATCH] submodule deinit: handle non existing pathspecs gracefully Martin Ågren
2018-03-28  5:06     ` Junio C Hamano
2018-03-28 19:37   ` git submodule deinit resulting in BUG: builtin/submodule--helper.c:1045: module_list_compute should not choke on empty pathspec Peter Oberndorfer
2018-03-28 21:19     ` Stefan Beller

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=20180327232824.112539-1-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kumbayo84@arcor.de \
    --cc=pc44800@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.