]> git.ipfire.org Git - thirdparty/git.git/commitdiff
branch: give submodule updating advice before exit
authorGlen Choo <chooglen@google.com>
Tue, 29 Mar 2022 20:01:17 +0000 (20:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Mar 2022 20:40:00 +0000 (13:40 -0700)
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>
branch.c

index 608db0fc91afe69b09ccb5db95bed2ff7bcb63d1..50459c432c0dbebf9948994c7c6711c1d3df34fe 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -602,11 +602,13 @@ void create_branches_recursively(struct repository *r, const char *name,
         */
        for (i = 0; i < submodule_entry_list.entry_nr; i++) {
                if (submodule_entry_list.entries[i].repo == NULL) {
+                       int code = die_message(
+                               _("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'"),
                                       start_commitish);
-                       die(_("submodule '%s': unable to find submodule"),
-                           submodule_entry_list.entries[i].submodule->name);
+                       exit(code);
                }
 
                if (submodule_create_branch(