sync: Delete symlinks relative to client topdir

If repo sync is invoked outside the repo root, and the latest manifest
removes symlinks, repo incorrectly tries to remove symlink - it starts
from `cwd` instead of the repo root.

Bug: b/113935847
Bug: 40010423
Change-Id: Ia50ea70a376e38c94389880f020c80da3c3f453c
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/445901
Tested-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
Josip Sokcevic 2024-12-13 18:24:20 +00:00
parent e8a7b9d596
commit 9500aca754

View File

@ -1442,7 +1442,10 @@ later is required to fix a server side protocol bug.
for need_remove_file in need_remove_files: for need_remove_file in need_remove_files:
# Try to remove the updated copyfile or linkfile. # Try to remove the updated copyfile or linkfile.
# So, if the file is not exist, nothing need to do. # So, if the file is not exist, nothing need to do.
platform_utils.remove(need_remove_file, missing_ok=True) platform_utils.remove(
os.path.join(self.client.topdir, need_remove_file),
missing_ok=True,
)
# Create copy-link-files.json, save dest path of "copyfile" and # Create copy-link-files.json, save dest path of "copyfile" and
# "linkfile". # "linkfile".