Re: [PATCH] branch: improve advice when --recurse-submodules fails
From: Glen Choo <hidden>
Date: 2023-01-18 21:59:03
"Philippe Blain via GitGitGadget" [off-list ref] writes:
From: Philippe Blain <redacted> '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.
Ah, yes that is true.
quoted hunk ↗ jump to hunk
diff --git a/branch.c b/branch.c index d182756827f..e5614b53b36 100644 --- 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); }
Makes sense. Thanks! Reviewed-by: Glen Choo <redacted>