diff mbox series

[2/4] branch: give submodule updating advice before exit

Message ID f21d283e5ade542b73cb36178c3c33008e2c67df.1648584079.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit cfbda6ba6b33e903df58f96fdb2ee9314097ff2f
Headers show
Series branch --recurse-submodules: Bug fixes and clean ups | expand

Commit Message

Glen Choo March 29, 2022, 8:01 p.m. UTC
From: Glen Choo <chooglen@google.com>

Fix a bug where "hint:" was printed _before_ "fatal:" (instead of the
other way around).

Signed-off-by: Glen Choo <chooglen@google.com>
---
 branch.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Junio C Hamano March 30, 2022, 9:15 p.m. UTC | #1
"Glen Choo via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Glen Choo <chooglen@google.com>
>
> Fix a bug where "hint:" was printed _before_ "fatal:" (instead of the
> other way around).
>
> Signed-off-by: Glen Choo <chooglen@google.com>
> ---
>  branch.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/branch.c b/branch.c
> index 7377b9f451a..133e6047bc6 100644
> --- a/branch.c
> +++ b/branch.c
> @@ -607,11 +607,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(

Great.

Thanks.
diff mbox series

Patch

diff --git a/branch.c b/branch.c
index 7377b9f451a..133e6047bc6 100644
--- a/branch.c
+++ b/branch.c
@@ -607,11 +607,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(