diff options
-rw-r--r-- | docs/manifest-format.txt | 2 | ||||
-rw-r--r-- | git_config.py | 6 | ||||
-rw-r--r-- | project.py | 14 |
3 files changed, 13 insertions, 9 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt index d5c6a024..1aa93965 100644 --- a/docs/manifest-format.txt +++ b/docs/manifest-format.txt | |||
@@ -244,7 +244,7 @@ whole ref space. | |||
244 | 244 | ||
245 | Attribute `sync-s`: Set to true to also sync sub-projects. | 245 | Attribute `sync-s`: Set to true to also sync sub-projects. |
246 | 246 | ||
247 | Attribute `upstream`: Name of the Git branch in which a sha1 | 247 | Attribute `upstream`: Name of the Git ref in which a sha1 |
248 | can be found. Used when syncing a revision locked manifest in | 248 | can be found. Used when syncing a revision locked manifest in |
249 | -c mode to avoid having to sync the entire ref space. | 249 | -c mode to avoid having to sync the entire ref space. |
250 | 250 | ||
diff --git a/git_config.py b/git_config.py index aa07d1b7..b4145e8c 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -619,8 +619,6 @@ class Remote(object): | |||
619 | """ | 619 | """ |
620 | if IsId(rev): | 620 | if IsId(rev): |
621 | return rev | 621 | return rev |
622 | if rev.startswith(R_TAGS): | ||
623 | return rev | ||
624 | 622 | ||
625 | if not rev.startswith('refs/'): | 623 | if not rev.startswith('refs/'): |
626 | rev = R_HEADS + rev | 624 | rev = R_HEADS + rev |
@@ -628,6 +626,10 @@ class Remote(object): | |||
628 | for spec in self.fetch: | 626 | for spec in self.fetch: |
629 | if spec.SourceMatches(rev): | 627 | if spec.SourceMatches(rev): |
630 | return spec.MapSource(rev) | 628 | return spec.MapSource(rev) |
629 | |||
630 | if not rev.startswith(R_HEADS): | ||
631 | return rev | ||
632 | |||
631 | raise GitError('remote %s does not have %s' % (self.name, rev)) | 633 | raise GitError('remote %s does not have %s' % (self.name, rev)) |
632 | 634 | ||
633 | def WritesTo(self, ref): | 635 | def WritesTo(self, ref): |
@@ -1730,10 +1730,11 @@ class Project(object): | |||
1730 | if depth: | 1730 | if depth: |
1731 | current_branch_only = True | 1731 | current_branch_only = True |
1732 | 1732 | ||
1733 | if ID_RE.match(self.revisionExpr) is not None: | ||
1734 | is_sha1 = True | ||
1735 | |||
1733 | if current_branch_only: | 1736 | if current_branch_only: |
1734 | if ID_RE.match(self.revisionExpr) is not None: | 1737 | if self.revisionExpr.startswith(R_TAGS): |
1735 | is_sha1 = True | ||
1736 | elif self.revisionExpr.startswith(R_TAGS): | ||
1737 | # this is a tag and its sha1 value should never change | 1738 | # this is a tag and its sha1 value should never change |
1738 | tag_name = self.revisionExpr[len(R_TAGS):] | 1739 | tag_name = self.revisionExpr[len(R_TAGS):] |
1739 | 1740 | ||
@@ -1820,9 +1821,10 @@ class Project(object): | |||
1820 | branch = self.revisionExpr | 1821 | branch = self.revisionExpr |
1821 | if is_sha1: | 1822 | if is_sha1: |
1822 | branch = self.upstream | 1823 | branch = self.upstream |
1823 | if branch.startswith(R_HEADS): | 1824 | if branch is not None and branch.strip(): |
1824 | branch = branch[len(R_HEADS):] | 1825 | if not branch.startswith('refs/'): |
1825 | spec.append(str((u'+refs/heads/%s:' % branch) + remote.ToLocal('refs/heads/%s' % branch))) | 1826 | branch = R_HEADS + branch |
1827 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) | ||
1826 | cmd.extend(spec) | 1828 | cmd.extend(spec) |
1827 | 1829 | ||
1828 | shallowfetch = self.config.GetString('repo.shallowfetch') | 1830 | shallowfetch = self.config.GetString('repo.shallowfetch') |