diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2015-04-27 10:41:33 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2015-04-27 10:56:27 +0900 |
commit | 403b64edf468204597559cf61b346b93af9af232 (patch) | |
tree | 535ad68291d80eaea7986ccfc9dc40946e2e78b0 /project.py | |
parent | a38769cda88fce2e96c02021060a4c7d2cb96cc8 (diff) | |
download | git-repo-403b64edf468204597559cf61b346b93af9af232.tar.gz |
Don't append branch to fetch spec when syncing to a mirrorv1.12.21
Appending the branch to the fetch spec causes sync of a mirror to
fail for projects that don't have an explicit revision specified,
and don't have a branch of the same name as the default revision.
For example, a manifest defining a default revision:
<default revision="master">
having a project without an explicit revision:
<project name="path/to/project">
and not having a branch named "master", will cause repo sync to
fail for that project with the error:
Couldn't find remote ref refs/heads/master
Modify the logic to not append the branch onto the fetch spec when
syncing to a mirror.
Change-Id: I5c4457bd125519abf27abe682dea62ad708978c9
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -1853,18 +1853,19 @@ class Project(object): | |||
1853 | spec.append('tag') | 1853 | spec.append('tag') |
1854 | spec.append(tag_name) | 1854 | spec.append(tag_name) |
1855 | 1855 | ||
1856 | branch = self.revisionExpr | 1856 | if not self.manifest.IsMirror: |
1857 | if is_sha1 and depth: | 1857 | branch = self.revisionExpr |
1858 | # Shallow checkout of a specific commit, fetch from that commit and not | 1858 | if is_sha1 and depth: |
1859 | # the heads only as the commit might be deeper in the history. | 1859 | # Shallow checkout of a specific commit, fetch from that commit and not |
1860 | spec.append(branch) | 1860 | # the heads only as the commit might be deeper in the history. |
1861 | else: | 1861 | spec.append(branch) |
1862 | if is_sha1: | 1862 | else: |
1863 | branch = self.upstream | 1863 | if is_sha1: |
1864 | if branch is not None and branch.strip(): | 1864 | branch = self.upstream |
1865 | if not branch.startswith('refs/'): | 1865 | if branch is not None and branch.strip(): |
1866 | branch = R_HEADS + branch | 1866 | if not branch.startswith('refs/'): |
1867 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) | 1867 | branch = R_HEADS + branch |
1868 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) | ||
1868 | cmd.extend(spec) | 1869 | cmd.extend(spec) |
1869 | 1870 | ||
1870 | shallowfetch = self.config.GetString('repo.shallowfetch') | 1871 | shallowfetch = self.config.GetString('repo.shallowfetch') |