summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2021-04-29 01:50:38 -0700
committerJonathan Nieder <jrn@google.com>2021-04-29 19:05:47 +0000
commitaabf79d3f0736af3bbe9f2e830df6165e06b6ef6 (patch)
tree8e9a6c44897c02349e69f7c2929eb52acabc1677 /project.py
parenta1cd770d566400364c43acd40b980a7138820797 (diff)
downloadgit-repo-aabf79d3f0736af3bbe9f2e830df6165e06b6ef6.tar.gz
sync: Fix a corner case when both superproject and depth used.
When depth is used, we would fetch only SHA1 when superproject is used, as the result, only the manifest branch is being recorded, and commands like repo start would fail. Fix this by saving the upstream branch value in the overlay manifest and add the upstream branch to fetch list. Bug: [google internal] b/185951360 Change-Id: Ib36f56067723f2572ed817785b31cc928ddfec0a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304562 Reviewed-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Xin Li <delphij@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/project.py b/project.py
index 6679ee31..94c13785 100644
--- a/project.py
+++ b/project.py
@@ -1214,6 +1214,9 @@ class Project(object):
1214 (self.revisionExpr, self.name)) 1214 (self.revisionExpr, self.name))
1215 1215
1216 def SetRevisionId(self, revisionId): 1216 def SetRevisionId(self, revisionId):
1217 if self.clone_depth or self.manifest.manifestProject.config.GetString('repo.depth'):
1218 self.upstream = self.revisionExpr
1219
1217 self.revisionId = revisionId 1220 self.revisionId = revisionId
1218 1221
1219 def Sync_LocalHalf(self, syncbuf, force_sync=False, submodules=False): 1222 def Sync_LocalHalf(self, syncbuf, force_sync=False, submodules=False):
@@ -2134,6 +2137,8 @@ class Project(object):
2134 # Shallow checkout of a specific commit, fetch from that commit and not 2137 # Shallow checkout of a specific commit, fetch from that commit and not
2135 # the heads only as the commit might be deeper in the history. 2138 # the heads only as the commit might be deeper in the history.
2136 spec.append(branch) 2139 spec.append(branch)
2140 if self.upstream:
2141 spec.append(self.upstream)
2137 else: 2142 else:
2138 if is_sha1: 2143 if is_sha1:
2139 branch = self.upstream 2144 branch = self.upstream