From c883613e317561579e164a7d92ea4347d502b86d Mon Sep 17 00:00:00 2001 From: Xin Li Date: Tue, 26 May 2026 15:52:48 -0700 Subject: [PATCH] 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 ), 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 to 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 Tested-by: Xin Li --- project.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project.py b/project.py index 6731f8599..b26e2a6ac 100644 --- a/project.py +++ b/project.py @@ -1575,6 +1575,8 @@ class Project: 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: