git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] branch: improve advice when --recurse-submodules fails
@ 2023-01-16 17:41 Philippe Blain via GitGitGadget
  2023-01-18 21:58 ` Glen Choo
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Blain via GitGitGadget @ 2023-01-16 17:41 UTC (permalink / raw)
  To: git; +Cc: Glen Choo, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

'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>
---
    branch: improve advice when --recurse-submodules fails
    
    Hi Glen,
    
    This is a small improvement I thought about when looking at that code
    recently.
    
    Cheers,
    
    Philippe.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1464%2Fphil-blain%2Fbranch-recurse-improve-advice-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1464/phil-blain/branch-recurse-improve-advice-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1464

 branch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
 		}

base-commit: 4dbebc36b0893f5094668ddea077d0e235560b16
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] branch: improve advice when --recurse-submodules fails
  2023-01-16 17:41 [PATCH] branch: improve advice when --recurse-submodules fails Philippe Blain via GitGitGadget
@ 2023-01-18 21:58 ` Glen Choo
  0 siblings, 0 replies; 2+ messages in thread
From: Glen Choo @ 2023-01-18 21:58 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget, git; +Cc: Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> '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.

> 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 <chooglen@google.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-18 21:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 17:41 [PATCH] branch: improve advice when --recurse-submodules fails Philippe Blain via GitGitGadget
2023-01-18 21:58 ` Glen Choo

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).