git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] submodule deinit: handle non existing pathspecs gracefully

From
Stefan Beller <sbeller@google.com>
Date
Mar 27, 2018, 23:28 UTC
Message-ID
<20180327232824.112539-1-sbeller@google.com>
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
Previous: Stefan BellerNext: Martin Ågren
Message 3 of 7 in “git submodule deinit resulting in BUG: builtin/submodule--helper.c:1045: module_list_compute should not choke on empty pathspec”
  1. Peter OberndorferMar 27, 2018
  2. Stefan BellerMar 27, 2018
  3. submodule deinit: handle non existing pathspecs gracefullyStefan Beller, Mar 27, 2018
  4. Martin ÅgrenMar 28, 2018
  5. Junio C HamanoMar 28, 2018
  6. Peter OberndorferMar 28, 2018
  7. Stefan BellerMar 28, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.