mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
Don't append branch to fetch spec when syncing to a mirror
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
This commit is contained in:
parent
a38769cda8
commit
403b64edf4
25
project.py
25
project.py
@ -1853,18 +1853,19 @@ class Project(object):
|
|||||||
spec.append('tag')
|
spec.append('tag')
|
||||||
spec.append(tag_name)
|
spec.append(tag_name)
|
||||||
|
|
||||||
branch = self.revisionExpr
|
if not self.manifest.IsMirror:
|
||||||
if is_sha1 and depth:
|
branch = self.revisionExpr
|
||||||
# Shallow checkout of a specific commit, fetch from that commit and not
|
if is_sha1 and depth:
|
||||||
# the heads only as the commit might be deeper in the history.
|
# Shallow checkout of a specific commit, fetch from that commit and not
|
||||||
spec.append(branch)
|
# the heads only as the commit might be deeper in the history.
|
||||||
else:
|
spec.append(branch)
|
||||||
if is_sha1:
|
else:
|
||||||
branch = self.upstream
|
if is_sha1:
|
||||||
if branch is not None and branch.strip():
|
branch = self.upstream
|
||||||
if not branch.startswith('refs/'):
|
if branch is not None and branch.strip():
|
||||||
branch = R_HEADS + branch
|
if not branch.startswith('refs/'):
|
||||||
spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch)))
|
branch = R_HEADS + branch
|
||||||
|
spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch)))
|
||||||
cmd.extend(spec)
|
cmd.extend(spec)
|
||||||
|
|
||||||
shallowfetch = self.config.GetString('repo.shallowfetch')
|
shallowfetch = self.config.GetString('repo.shallowfetch')
|
||||||
|
Loading…
Reference in New Issue
Block a user