]> git.ipfire.org Git - thirdparty/git.git/commitdiff
branch: improve advice when --recurse-submodules fails
authorPhilippe Blain <levraiphilippeblain@gmail.com>
Mon, 16 Jan 2023 17:41:48 +0000 (17:41 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Jan 2023 23:13:21 +0000 (15:13 -0800)
'git branch --recurse-submodules start from-here' fails if any submodule
present in 'from-here' is not yet cloned (under
submodule.propagateBranches=true). We then give this advice:

   "You may try updating the submodules using 'git checkout from-here && git submodule update --init'"

If 'submodule.recurse' is set, 'git checkout from-here' will also fail since
it will try to recursively checkout the submodules.

Improve the advice by adding '--no-recurse-submodules' to the checkout
command.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Reviewed-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch.c

index d182756827fe5128292798b707a52aed25e7aa48..e5614b53b3699d9fc08d41135b16a4a875b0fc68 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -756,7 +756,7 @@ void create_branches_recursively(struct repository *r, const char *name,
                                _("submodule '%s': unable to find submodule"),
                                submodule_entry_list.entries[i].submodule->name);
                        if (advice_enabled(ADVICE_SUBMODULES_NOT_UPDATED))
-                               advise(_("You may try updating the submodules using 'git checkout %s && git submodule update --init'"),
+                               advise(_("You may try updating the submodules using 'git checkout --no-recurse-submodules %s && git submodule update --init'"),
                                       start_commitish);
                        exit(code);
                }