From 9748e39d0c17a79e67d2728199515cf40e2850dc Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Tue, 27 Mar 2018 16:28:24 -0700 Subject: [PATCH] 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 Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- 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 b1daca995f..b5d3713798 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)