+ * Not implemented for non-bare repositories.
+ *
+ * @param enable Whether to record the shallow recommendation.
+ * @return this command
+ * @since 4.4
+ */
+ public RepoCommand setRecommendShallow(boolean enable) {
+ this.recordShallowSubmodules = enable;
+ return this;
+ }
+
/**
* The progress monitor associated with the clone operation. By default,
* this is set to NullProgressMonitor
@@ -471,7 +487,8 @@ public RevCommit call() throws GitAPIException {
proj.getPath(),
proj.getRevision(),
proj.getCopyFiles(),
- proj.getGroups());
+ proj.getGroups(),
+ proj.getRecommendShallow());
}
} catch (GitAPIException | IOException e) {
throw new ManifestErrorException(e);
@@ -512,6 +529,16 @@ public RevCommit call() throws GitAPIException {
cfg.setString("submodule", name, "branch", //$NON-NLS-1$ //$NON-NLS-2$
proj.getRevision());
}
+
+ if (recordShallowSubmodules && proj.getRecommendShallow() != null) {
+ // The shallow recommendation is losing information.
+ // As the repo manifests stores the recommended
+ // depth in the 'clone-depth' field, while
+ // git core only uses a binary 'shallow = true/false'
+ // hint, we'll map any depth to 'shallow = true'
+ cfg.setBoolean("submodule", name, "shallow", //$NON-NLS-1$ //$NON-NLS-2$
+ true);
+ }
}
if (recordSubmoduleLabels) {
StringBuilder rec = new StringBuilder();
@@ -616,10 +643,10 @@ public RevCommit call() throws GitAPIException {
}
private void addSubmodule(String url, String name, String revision,
- List