Skip to content

Commit 584863f

Browse files
Kaushik LingarkarLUCI
authored andcommitted
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 <[email protected]> Tested-by: Kaushik Lingarkar <[email protected]> Reviewed-by: Josip Sokcevic <[email protected]> Reviewed-by: Nasser Grainawi <[email protected]>
1 parent 454fdaf commit 584863f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

project.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,9 @@ def git_ls_tree(gitdir, rev, paths):
22962296

22972297
try:
22982298
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.
23002302
return []
23012303
return get_submodules(self.gitdir, rev)
23022304

0 commit comments

Comments
 (0)