From: Stefan Beller <sbeller@google.com>
To: bmwill@google.com, maxime.viargues@serato.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [PATCH 2/2] clone: remember references for submodules even when not recursing
Date: Tue, 11 Apr 2017 12:46:16 -0700 [thread overview]
Message-ID: <20170411194616.4963-3-sbeller@google.com> (raw)
In-Reply-To: <20170411194616.4963-1-sbeller@google.com>
The commit 31224cbdc7 (clone: recursive and reference option triggers
submodule alternates, 2016-08-17) argued for any further `submodule update`
to respect the initial setup. This is not the case if you only pass
'--reference[-if-able]' to the initial clone without instructing to
recurse into submodules.
If there are submodules however the user is likely to later run
a 'submodule update --init' to obtain the submodules. In this case we
also want to have the references available.
Reported-by: Maxime Viargues <maxime.viargues@serato.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
builtin/clone.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index de85b85254..5f022e39e9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -24,6 +24,7 @@
#include "remote.h"
#include "run-command.h"
#include "connected.h"
+#include "submodule.h"
/*
* Overall FIXMEs:
@@ -993,11 +994,14 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
string_list_append(&option_config,
strbuf_detach(&sb, NULL));
}
+ }
+ if (option_recurse_submodules.nr ||
+ has_submodules(SUBMODULE_CHECK_GITMODULES_IN_WT)) {
if (option_required_reference.nr &&
option_optional_reference.nr)
- die(_("clone --recursive is not compatible with "
- "both --reference and --reference-if-able"));
+ die(_("submodules are incompatible with both "
+ "--reference and --reference-if-able"));
else if (option_required_reference.nr) {
string_list_append(&option_config,
"submodule.alternateLocation=superproject");
--
2.12.2.575.gb14f27f917
next prev parent reply other threads:[~2017-04-11 19:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 19:46 [PATCH 0/2] clone: record submodule alternates when not recursing Stefan Beller
2017-04-11 19:46 ` [PATCH 1/2] submodule.c: add has_submodules to check if we have any submodules Stefan Beller
2017-04-20 22:07 ` Brandon Williams
2017-04-20 22:20 ` Stefan Beller
2017-04-20 22:25 ` Brandon Williams
2017-04-11 19:46 ` Stefan Beller [this message]
2017-04-20 22:12 ` [PATCH 2/2] clone: remember references for submodules even when not recursing Brandon Williams
2017-04-20 22:28 ` Stefan Beller
2017-04-19 19:52 ` [PATCH 0/2] clone: record submodule alternates " Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170411194616.4963-3-sbeller@google.com \
--to=sbeller@google.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=maxime.viargues@serato.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).