branch: give submodule updating advice before exit

Fix a bug where "hint:" was printed _before_ "fatal:" (instead of the other way around). Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Glen Choo committed Mar 29, 2022 at 20:01 UTC cfbda6ba6b33e903df58f96fdb2ee9314097ff2f
1 file changed +4 -2
branch.c
+4 -2
@@ -602,11 +602,13 @@ void create_branches_recursively(struct repository *r, const char *name,
602 */
603 for (i = 0; i < submodule_entry_list.entry_nr; i++) {
604 if (submodule_entry_list.entries[i].repo == NULL) {
605 + int code = die_message(
606 + _("submodule '%s': unable to find submodule"),
607 + submodule_entry_list.entries[i].submodule->name);
608 if (advice_enabled(ADVICE_SUBMODULES_NOT_UPDATED))
609 advise(_("You may try updating the submodules using 'git checkout %s && git submodule update --init'"),
610 start_commitish);
608 - die(_("submodule '%s': unable to find submodule"),
609 - submodule_entry_list.entries[i].submodule->name);
611 + exit(code);
612 }
613
614 if (submodule_create_branch(