diff options
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -1728,6 +1728,9 @@ class Project(object): | |||
1728 | depth = self.clone_depth | 1728 | depth = self.clone_depth |
1729 | else: | 1729 | else: |
1730 | depth = self.manifest.manifestProject.config.GetString('repo.depth') | 1730 | depth = self.manifest.manifestProject.config.GetString('repo.depth') |
1731 | # The repo project should never be synced with partial depth | ||
1732 | if self.relpath == '.repo/repo': | ||
1733 | depth = None | ||
1731 | 1734 | ||
1732 | if depth: | 1735 | if depth: |
1733 | current_branch_only = True | 1736 | current_branch_only = True |
@@ -1801,9 +1804,7 @@ class Project(object): | |||
1801 | 1804 | ||
1802 | cmd = ['fetch'] | 1805 | cmd = ['fetch'] |
1803 | 1806 | ||
1804 | # The --depth option only affects the initial fetch; after that we'll do | 1807 | if depth: |
1805 | # full fetches of changes. | ||
1806 | if depth and initial: | ||
1807 | cmd.append('--depth=%s' % depth) | 1808 | cmd.append('--depth=%s' % depth) |
1808 | 1809 | ||
1809 | if quiet: | 1810 | if quiet: |
@@ -1852,10 +1853,24 @@ class Project(object): | |||
1852 | 1853 | ||
1853 | ok = False | 1854 | ok = False |
1854 | for _i in range(2): | 1855 | for _i in range(2): |
1855 | ret = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy).Wait() | 1856 | gitcmd = GitCommand(self, cmd, bare=True, capture_stderr=True, |
1857 | ssh_proxy=ssh_proxy) | ||
1858 | ret = gitcmd.Wait() | ||
1859 | print(gitcmd.stderr, file=sys.stderr, end='') | ||
1856 | if ret == 0: | 1860 | if ret == 0: |
1857 | ok = True | 1861 | ok = True |
1858 | break | 1862 | break |
1863 | # If needed, run the 'git remote prune' the first time through the loop | ||
1864 | elif (not _i and | ||
1865 | "error:" in gitcmd.stderr and | ||
1866 | "git remote prune" in gitcmd.stderr): | ||
1867 | prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True, | ||
1868 | capture_stderr=True, ssh_proxy=ssh_proxy) | ||
1869 | ret = prunecmd.Wait() | ||
1870 | print(prunecmd.stderr, file=sys.stderr, end='') | ||
1871 | if ret: | ||
1872 | break | ||
1873 | continue | ||
1859 | elif current_branch_only and is_sha1 and ret == 128: | 1874 | elif current_branch_only and is_sha1 and ret == 128: |
1860 | # Exit code 128 means "couldn't find the ref you asked for"; if we're in sha1 | 1875 | # Exit code 128 means "couldn't find the ref you asked for"; if we're in sha1 |
1861 | # mode, we just tried sync'ing from the upstream field; it doesn't exist, thus | 1876 | # mode, we just tried sync'ing from the upstream field; it doesn't exist, thus |