sync: Skip copyfile/linkfile for unavailable projects Commit 5534f16 made UpdateCopyLinkfileList to retry _CopyAndLinkFiles for all projects in the manifest to handle directory-to-symlink transistions. However, for partial sync's (e.g. repo sync <project>), projects not included in the sync may not have their local directories populated, attempts to perform the operation on unavailable projects would result in dangling symlinks, or errors like: error: Cannot copy file <source> to <destination> Fix this by adding a check inside _CopyAndLinkFiles in project.py to so these operations happen only when the project's worktree exists and is a directory. TAG=agy CONV=90f5fca7-2199-4017-8f62-a010b0ab1dbf Change-Id: I9ae1e8d62d8fd129cb4535e574c38339c87af441 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/587501 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
diff --git a/project.py b/project.py index 6731f85..b26e2a6 100644 --- a/project.py +++ b/project.py
@@ -1575,6 +1575,8 @@ self._InitHooks() def _CopyAndLinkFiles(self): + if not self.worktree or not platform_utils.isdir(self.worktree): + return for copyfile in self.copyfiles: copyfile._Copy() for linkfile in self.linkfiles: