submodule deinit: handle non existing pathspecs gracefully

This fixes a regression introduced in 2e612731b5 (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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Mar 27, 2018 at 16:28 UTC 9748e39d0c17a79e67d2728199515cf40e2850dc
1 file changed +1 -1
builtin/submodule--helper.c
+1 -1
@@ -1042,7 +1042,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)
1042 die(_("Use '--all' if you really want to deinitialize all submodules"));
1043
1044 if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
1045 - BUG("module_list_compute should not choke on empty pathspec");
1045 + return 1;
1046
1047 info.prefix = prefix;
1048 if (quiet)