{"thread":{"id":"59096","subject":"[PATCH] branch: improve advice when --recurse-submodules fails","startedAt":"2023-01-16T17:59:44Z","lastAt":"2023-01-18T21:59:03Z","messageCount":2,"participants":["Philippe Blain via GitGitGadget","Glen Choo"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"470450","messageId":"pull.1464.git.1673890908453.gitgitgadget@gmail.com","threadId":"59096","inReplyTo":null,"subject":"[PATCH] branch: improve advice when --recurse-submodules fails","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-01-16T17:41:48Z","receivedAt":"2023-01-16T17:59:44Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\n'git branch --recurse-submodules start from-here' fails if any submodule\npresent in 'from-here' is not yet cloned (under\nsubmodule.propagateBranches=true). We then give this advice:\n\n   \"You may try updating the submodules using 'git checkout from-here && git submodule update --init'\"\n\nIf 'submodule.recurse' is set, 'git checkout from-here' will also fail since\nit will try to recursively checkout the submodules.\n\nImprove the advice by adding '--no-recurse-submodules' to the checkout\ncommand.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n    branch: improve advice when --recurse-submodules fails\n    \n    Hi Glen,\n    \n    This is a small improvement I thought about when looking at that code\n    recently.\n    \n    Cheers,\n    \n    Philippe.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1464%2Fphil-blain%2Fbranch-recurse-improve-advice-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1464/phil-blain/branch-recurse-improve-advice-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1464\n\n branch.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/branch.c b/branch.c\nindex d182756827f..e5614b53b36 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -756,7 +756,7 @@ void create_branches_recursively(struct repository *r, const char *name,\n \t\t\t\t_(\"submodule '%s': unable to find submodule\"),\n \t\t\t\tsubmodule_entry_list.entries[i].submodule->name);\n \t\t\tif (advice_enabled(ADVICE_SUBMODULES_NOT_UPDATED))\n-\t\t\t\tadvise(_(\"You may try updating the submodules using 'git checkout %s && git submodule update --init'\"),\n+\t\t\t\tadvise(_(\"You may try updating the submodules using 'git checkout --no-recurse-submodules %s && git submodule update --init'\"),\n \t\t\t\t       start_commitish);\n \t\t\texit(code);\n \t\t}\n\nbase-commit: 4dbebc36b0893f5094668ddea077d0e235560b16\n-- \ngitgitgadget\n"},{"id":"470674","messageId":"kl6lo7qvo67h.fsf@chooglen-macbookpro.roam.corp.google.com","threadId":"59096","inReplyTo":"pull.1464.git.1673890908453.gitgitgadget@gmail.com","subject":"Re: [PATCH] branch: improve advice when --recurse-submodules fails","fromName":"Glen Choo","fromEmail":"chooglen@google.com","sentAt":"2023-01-18T21:58:42Z","receivedAt":"2023-01-18T21:59:03Z","isPatch":true,"sender":{"key":"glencbz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58092771?v=4"},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> 'git branch --recurse-submodules start from-here' fails if any submodule\n> present in 'from-here' is not yet cloned (under\n> submodule.propagateBranches=true). We then give this advice:\n>\n>    \"You may try updating the submodules using 'git checkout from-here && git submodule update --init'\"\n>\n> If 'submodule.recurse' is set, 'git checkout from-here' will also fail since\n> it will try to recursively checkout the submodules.\n\nAh, yes that is true.\n\n> diff --git a/branch.c b/branch.c\n> index d182756827f..e5614b53b36 100644\n> --- a/branch.c\n> +++ b/branch.c\n> @@ -756,7 +756,7 @@ void create_branches_recursively(struct repository *r, const char *name,\n>  \t\t\t\t_(\"submodule '%s': unable to find submodule\"),\n>  \t\t\t\tsubmodule_entry_list.entries[i].submodule->name);\n>  \t\t\tif (advice_enabled(ADVICE_SUBMODULES_NOT_UPDATED))\n> -\t\t\t\tadvise(_(\"You may try updating the submodules using 'git checkout %s && git submodule update --init'\"),\n> +\t\t\t\tadvise(_(\"You may try updating the submodules using 'git checkout --no-recurse-submodules %s && git submodule update --init'\"),\n>  \t\t\t\t       start_commitish);\n>  \t\t\texit(code);\n>  \t\t}\n>\n\nMakes sense. Thanks!\n\nReviewed-by: Glen Choo <chooglen@google.com>\n"}]}