From 17833322d9e0c650310e55f806d5e3545c265c2a Mon Sep 17 00:00:00 2001 From: Jason Chang Date: Tue, 23 May 2023 13:06:55 -0700 Subject: Add envar to replace shallow clones with partial An investigation go/git-repo-shallow shows a number of problems when doing a shallow git fetch/clone. This change introduces an environment variable REPO_ALLOW_SHALLOW. When this environment variable is set to 1 during a repo init or repo sync all shallow git fetch commands are replaced with partial fetch commands. Any shallow repository needing update is unshallowed. This behavior continues until a subsequent repo sync command is run with REPO_ALLOW_SHALLOW set to 1. Bug: b/274340522 Change-Id: I1c3188270629359e52449788897d9d4988ebf280 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/374754 Reviewed-by: Josip Sokcevic Tested-by: Jason Chang --- manifest_xml.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index 14b03a30..555bf736 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -981,6 +981,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md return self.manifestProject.clone_filter return None + @property + def CloneFilterForDepth(self): + if self.manifestProject.clone_filter_for_depth: + return self.manifestProject.clone_filter_for_depth + return None + @property def PartialCloneExclude(self): exclude = self.manifest.manifestProject.partial_clone_exclude or "" -- cgit v1.2.3-54-g00ecf