From 4f3e57ef13d0ad4c00d0a87f0858cde81456a2e0 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Mon, 2 Dec 2019 11:57:52 -0800 Subject: submodule--helper: advise on fatal alternate error When recursively cloning a superproject with some shallow modules defined in its .gitmodules, then recloning with "--reference=", an error occurs. For example: git clone --recurse-submodules --branch=master -j8 \ https://android.googlesource.com/platform/superproject \ master git clone --recurse-submodules --branch=master -j8 \ https://android.googlesource.com/platform/superproject \ --reference master master2 fails with: fatal: submodule '' cannot add alternate: reference repository '' is shallow When a alternate computed from the superproject's alternate cannot be added, whether in this case or another, advise about configuring the "submodule.alternateErrorStrategy" configuration option and using "--reference-if-able" instead of "--reference" when cloning. Signed-off-by: Jonathan Tan Acked-by: Jeff King Signed-off-by: Junio C Hamano --- advice.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'advice.c') diff --git a/advice.c b/advice.c index 3ee0ee2d8f..249c60dcf3 100644 --- a/advice.c +++ b/advice.c @@ -30,6 +30,7 @@ int advice_waiting_for_editor = 1; int advice_graft_file_deprecated = 1; int advice_checkout_ambiguous_remote_branch_name = 1; int advice_nested_tag = 1; +int advice_submodule_alternate_error_strategy_die = 1; static int advice_use_color = -1; static char advice_colors[][COLOR_MAXLEN] = { @@ -89,6 +90,7 @@ static struct { { "graftFileDeprecated", &advice_graft_file_deprecated }, { "checkoutAmbiguousRemoteBranchName", &advice_checkout_ambiguous_remote_branch_name }, { "nestedTag", &advice_nested_tag }, + { "submoduleAlternateErrorStrategyDie", &advice_submodule_alternate_error_strategy_die }, /* make this an alias for backward compatibility */ { "pushNonFastForward", &advice_push_update_rejected } -- cgit v1.2.1