summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushik Lingarkar <kaushik.lingarkar@linaro.org>2024-10-16 14:17:24 -0700
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-10-18 03:55:10 +0000
commit584863fb5e3e17ab364de40f80b10ac030b47788 (patch)
tree5be85f3c6e12229c4a58293aa9cccf0124d94344
parent454fdaf1191c87e5c770ab865a911e10e600e178 (diff)
downloadgit-repo-584863fb5e3e17ab364de40f80b10ac030b47788.tar.gz
Fix incremental syncs for prjs with submodules
When performing an incremental sync (re-running repo init with an updated manifest revision) with --fetch-submodules or sync-s=true, there is an attempt to get a list of all projects (including submodules) before projects are actually fetched. However, we can only list submodules of a project if we have already fetched its revision. Instead of throwing an error when we don't have the revision, assume there are no submodules for that project. In the sync cmd, we already update the list of projects to include submodules after fetching superprojects. Change-Id: I48bc68c48b5b10117356b18f5375d17f9a89ec05 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/439761 Commit-Queue: Kaushik Lingarkar <kaushik.lingarkar@linaro.org> Tested-by: Kaushik Lingarkar <kaushik.lingarkar@linaro.org> Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Nasser Grainawi <nasser.grainawi@linaro.org>
-rw-r--r--project.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/project.py b/project.py
index 1d8ab556..50daa82f 100644
--- a/project.py
+++ b/project.py
@@ -2296,7 +2296,9 @@ class Project:
2296 2296
2297 try: 2297 try:
2298 rev = self.GetRevisionId() 2298 rev = self.GetRevisionId()
2299 except GitError: 2299 except (GitError, ManifestInvalidRevisionError):
2300 # The git repo may be outdated (i.e. not fetched yet) and querying
2301 # its submodules using the revision may not work; so return here.
2300 return [] 2302 return []
2301 return get_submodules(self.gitdir, rev) 2303 return get_submodules(self.gitdir, rev)
2302 2304