diff options
author | Shawn Pearce <sop@google.com> | 2014-01-29 12:48:54 -0800 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2014-01-29 12:48:54 -0800 |
commit | 69e04d89538e4a253efe7d9f4fd1f1ae70f8f62c (patch) | |
tree | c6149053b8bf088bd751eee7118568cc64103e97 | |
parent | 12fd10c20115046dcd2fbe468a45e566f38ffbc9 (diff) | |
download | git-repo-69e04d89538e4a253efe7d9f4fd1f1ae70f8f62c.tar.gz |
Only fetch current branch on shallow clients
Fetching a new branch on a shallow client may download the entire
project history, as the depth parameter is not passed to git
fetch. Force the fetch to only download the current branch.
Change-Id: Ie17ce8eb5e3487c24d90b2cae8227319dea482c8
-rw-r--r-- | project.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1593,6 +1593,13 @@ class Project(object): | |||
1593 | # There is no such persistent revision. We have to fetch it. | 1593 | # There is no such persistent revision. We have to fetch it. |
1594 | return False | 1594 | return False |
1595 | 1595 | ||
1596 | if self.clone_depth: | ||
1597 | depth = self.clone_depth | ||
1598 | else: | ||
1599 | depth = self.manifest.manifestProject.config.GetString('repo.depth') | ||
1600 | if depth: | ||
1601 | current_branch_only = True | ||
1602 | |||
1596 | if current_branch_only: | 1603 | if current_branch_only: |
1597 | if ID_RE.match(self.revisionExpr) is not None: | 1604 | if ID_RE.match(self.revisionExpr) is not None: |
1598 | is_sha1 = True | 1605 | is_sha1 = True |
@@ -1656,10 +1663,6 @@ class Project(object): | |||
1656 | 1663 | ||
1657 | # The --depth option only affects the initial fetch; after that we'll do | 1664 | # The --depth option only affects the initial fetch; after that we'll do |
1658 | # full fetches of changes. | 1665 | # full fetches of changes. |
1659 | if self.clone_depth: | ||
1660 | depth = self.clone_depth | ||
1661 | else: | ||
1662 | depth = self.manifest.manifestProject.config.GetString('repo.depth') | ||
1663 | if depth and initial: | 1666 | if depth and initial: |
1664 | cmd.append('--depth=%s' % depth) | 1667 | cmd.append('--depth=%s' % depth) |
1665 | 1668 | ||