diff options
-rw-r--r-- | project.py | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -1264,13 +1264,18 @@ class Project(object): | |||
1264 | elif self.manifest.default.sync_c: | 1264 | elif self.manifest.default.sync_c: |
1265 | current_branch_only = True | 1265 | current_branch_only = True |
1266 | 1266 | ||
1267 | if self.clone_depth: | ||
1268 | depth = self.clone_depth | ||
1269 | else: | ||
1270 | depth = self.manifest.manifestProject.config.GetString('repo.depth') | ||
1271 | |||
1267 | need_to_fetch = not (optimized_fetch and | 1272 | need_to_fetch = not (optimized_fetch and |
1268 | (ID_RE.match(self.revisionExpr) and | 1273 | (ID_RE.match(self.revisionExpr) and |
1269 | self._CheckForSha1())) | 1274 | self._CheckForSha1())) |
1270 | if (need_to_fetch and | 1275 | if (need_to_fetch and |
1271 | not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, | 1276 | not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, |
1272 | current_branch_only=current_branch_only, | 1277 | current_branch_only=current_branch_only, |
1273 | no_tags=no_tags, prune=prune)): | 1278 | no_tags=no_tags, prune=prune, depth=depth)): |
1274 | return False | 1279 | return False |
1275 | 1280 | ||
1276 | if self.worktree: | 1281 | if self.worktree: |
@@ -1886,23 +1891,17 @@ class Project(object): | |||
1886 | quiet=False, | 1891 | quiet=False, |
1887 | alt_dir=None, | 1892 | alt_dir=None, |
1888 | no_tags=False, | 1893 | no_tags=False, |
1889 | prune=False): | 1894 | prune=False, |
1895 | depth=None): | ||
1890 | 1896 | ||
1891 | is_sha1 = False | 1897 | is_sha1 = False |
1892 | tag_name = None | 1898 | tag_name = None |
1893 | depth = None | ||
1894 | |||
1895 | # The depth should not be used when fetching to a mirror because | 1899 | # The depth should not be used when fetching to a mirror because |
1896 | # it will result in a shallow repository that cannot be cloned or | 1900 | # it will result in a shallow repository that cannot be cloned or |
1897 | # fetched from. | 1901 | # fetched from. |
1898 | if not self.manifest.IsMirror: | 1902 | # The repo project should also never be synced with partial depth. |
1899 | if self.clone_depth: | 1903 | if self.manifest.IsMirror or self.relpath == '.repo/repo': |
1900 | depth = self.clone_depth | 1904 | depth = None |
1901 | else: | ||
1902 | depth = self.manifest.manifestProject.config.GetString('repo.depth') | ||
1903 | # The repo project should never be synced with partial depth | ||
1904 | if self.relpath == '.repo/repo': | ||
1905 | depth = None | ||
1906 | 1905 | ||
1907 | if depth: | 1906 | if depth: |
1908 | current_branch_only = True | 1907 | current_branch_only = True |
@@ -2063,21 +2062,22 @@ class Project(object): | |||
2063 | os.remove(packed_refs) | 2062 | os.remove(packed_refs) |
2064 | self.bare_git.pack_refs('--all', '--prune') | 2063 | self.bare_git.pack_refs('--all', '--prune') |
2065 | 2064 | ||
2066 | if is_sha1 and current_branch_only and self.upstream: | 2065 | if is_sha1 and current_branch_only: |
2067 | # We just synced the upstream given branch; verify we | 2066 | # We just synced the upstream given branch; verify we |
2068 | # got what we wanted, else trigger a second run of all | 2067 | # got what we wanted, else trigger a second run of all |
2069 | # refs. | 2068 | # refs. |
2070 | if not self._CheckForSha1(): | 2069 | if not self._CheckForSha1(): |
2071 | if not depth: | 2070 | if current_branch_only and depth: |
2072 | # Avoid infinite recursion when depth is True (since depth implies | 2071 | # Sync the current branch only with depth set to None |
2073 | # current_branch_only) | ||
2074 | return self._RemoteFetch(name=name, current_branch_only=False, | ||
2075 | initial=False, quiet=quiet, alt_dir=alt_dir) | ||
2076 | if self.clone_depth: | ||
2077 | self.clone_depth = None | ||
2078 | return self._RemoteFetch(name=name, | 2072 | return self._RemoteFetch(name=name, |
2079 | current_branch_only=current_branch_only, | 2073 | current_branch_only=current_branch_only, |
2080 | initial=False, quiet=quiet, alt_dir=alt_dir) | 2074 | initial=False, quiet=quiet, alt_dir=alt_dir, |
2075 | depth=None) | ||
2076 | else: | ||
2077 | # Avoid infinite recursion: sync all branches with depth set to None | ||
2078 | return self._RemoteFetch(name=name, current_branch_only=False, | ||
2079 | initial=False, quiet=quiet, alt_dir=alt_dir, | ||
2080 | depth=None) | ||
2081 | 2081 | ||
2082 | return ok | 2082 | return ok |
2083 | 2083 | ||