diff options
Diffstat (limited to 'subcmds')
-rw-r--r-- | subcmds/init.py | 6 | ||||
-rw-r--r-- | subcmds/sync.py | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 9946466d..6d7fd857 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -20,6 +20,8 @@ from command import InteractiveCommand, MirrorSafeCommand | |||
20 | from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD | 20 | from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD |
21 | from wrapper import Wrapper | 21 | from wrapper import Wrapper |
22 | 22 | ||
23 | _REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW") | ||
24 | |||
23 | 25 | ||
24 | class Init(InteractiveCommand, MirrorSafeCommand): | 26 | class Init(InteractiveCommand, MirrorSafeCommand): |
25 | COMMON = True | 27 | COMMON = True |
@@ -125,6 +127,9 @@ to update the working directory files. | |||
125 | # manifest project is special and is created when instantiating the | 127 | # manifest project is special and is created when instantiating the |
126 | # manifest which happens before we parse options. | 128 | # manifest which happens before we parse options. |
127 | self.manifest.manifestProject.clone_depth = opt.manifest_depth | 129 | self.manifest.manifestProject.clone_depth = opt.manifest_depth |
130 | clone_filter_for_depth = ( | ||
131 | "blob:none" if (_REPO_ALLOW_SHALLOW == "0") else None | ||
132 | ) | ||
128 | if not self.manifest.manifestProject.Sync( | 133 | if not self.manifest.manifestProject.Sync( |
129 | manifest_url=opt.manifest_url, | 134 | manifest_url=opt.manifest_url, |
130 | manifest_branch=opt.manifest_branch, | 135 | manifest_branch=opt.manifest_branch, |
@@ -140,6 +145,7 @@ to update the working directory files. | |||
140 | partial_clone=opt.partial_clone, | 145 | partial_clone=opt.partial_clone, |
141 | clone_filter=opt.clone_filter, | 146 | clone_filter=opt.clone_filter, |
142 | partial_clone_exclude=opt.partial_clone_exclude, | 147 | partial_clone_exclude=opt.partial_clone_exclude, |
148 | clone_filter_for_depth=clone_filter_for_depth, | ||
143 | clone_bundle=opt.clone_bundle, | 149 | clone_bundle=opt.clone_bundle, |
144 | git_lfs=opt.git_lfs, | 150 | git_lfs=opt.git_lfs, |
145 | use_superproject=opt.use_superproject, | 151 | use_superproject=opt.use_superproject, |
diff --git a/subcmds/sync.py b/subcmds/sync.py index a44ed5b4..9ae8a4ce 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -79,6 +79,8 @@ _ONE_DAY_S = 24 * 60 * 60 | |||
79 | _REPO_AUTO_GC = "REPO_AUTO_GC" | 79 | _REPO_AUTO_GC = "REPO_AUTO_GC" |
80 | _AUTO_GC = os.environ.get(_REPO_AUTO_GC) == "1" | 80 | _AUTO_GC = os.environ.get(_REPO_AUTO_GC) == "1" |
81 | 81 | ||
82 | _REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW") | ||
83 | |||
82 | 84 | ||
83 | class _FetchOneResult(NamedTuple): | 85 | class _FetchOneResult(NamedTuple): |
84 | """_FetchOne return value. | 86 | """_FetchOne return value. |
@@ -638,6 +640,7 @@ later is required to fix a server side protocol bug. | |||
638 | ssh_proxy=self.ssh_proxy, | 640 | ssh_proxy=self.ssh_proxy, |
639 | clone_filter=project.manifest.CloneFilter, | 641 | clone_filter=project.manifest.CloneFilter, |
640 | partial_clone_exclude=project.manifest.PartialCloneExclude, | 642 | partial_clone_exclude=project.manifest.PartialCloneExclude, |
643 | clone_filter_for_depth=project.manifest.CloneFilterForDepth, | ||
641 | ) | 644 | ) |
642 | success = sync_result.success | 645 | success = sync_result.success |
643 | remote_fetched = sync_result.remote_fetched | 646 | remote_fetched = sync_result.remote_fetched |
@@ -1440,6 +1443,7 @@ later is required to fix a server side protocol bug. | |||
1440 | submodules=mp.manifest.HasSubmodules, | 1443 | submodules=mp.manifest.HasSubmodules, |
1441 | clone_filter=mp.manifest.CloneFilter, | 1444 | clone_filter=mp.manifest.CloneFilter, |
1442 | partial_clone_exclude=mp.manifest.PartialCloneExclude, | 1445 | partial_clone_exclude=mp.manifest.PartialCloneExclude, |
1446 | clone_filter_for_depth=mp.manifest.CloneFilterForDepth, | ||
1443 | ) | 1447 | ) |
1444 | finish = time.time() | 1448 | finish = time.time() |
1445 | self.event_log.AddSync( | 1449 | self.event_log.AddSync( |
@@ -1589,6 +1593,15 @@ later is required to fix a server side protocol bug. | |||
1589 | _PostRepoUpgrade(manifest, quiet=opt.quiet) | 1593 | _PostRepoUpgrade(manifest, quiet=opt.quiet) |
1590 | 1594 | ||
1591 | mp = manifest.manifestProject | 1595 | mp = manifest.manifestProject |
1596 | |||
1597 | if _REPO_ALLOW_SHALLOW is not None: | ||
1598 | if _REPO_ALLOW_SHALLOW == "1": | ||
1599 | mp.ConfigureCloneFilterForDepth(None) | ||
1600 | elif ( | ||
1601 | _REPO_ALLOW_SHALLOW == "0" and mp.clone_filter_for_depth is None | ||
1602 | ): | ||
1603 | mp.ConfigureCloneFilterForDepth("blob:none") | ||
1604 | |||
1592 | if opt.mp_update: | 1605 | if opt.mp_update: |
1593 | self._UpdateAllManifestProjects(opt, mp, manifest_name) | 1606 | self._UpdateAllManifestProjects(opt, mp, manifest_name) |
1594 | else: | 1607 | else: |