From d33dce0b773dae95987c337c5f84007d0cdd2b0e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 20 Dec 2021 18:16:33 -0500 Subject: [PATCH] project: drop support for symlinking internal .git files Since we don't do this anymore, and there prob won't be a need to bring it back, drop support for it. Bug: https://crbug.com/gerrit/15460 Change-Id: I7d86706f108c797a5c7962cb1578693d49430367 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/327537 Reviewed-by: Jack Neus Tested-by: Mike Frysinger --- project.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/project.py b/project.py index 48287858..edd748d0 100644 --- a/project.py +++ b/project.py @@ -457,7 +457,6 @@ class RemoteSpec(object): class Project(object): # These objects can be shared between several working trees. - shareable_files = [] shareable_dirs = ['hooks', 'objects', 'rr-cache'] def __init__(self, @@ -2651,10 +2650,7 @@ class Project(object): if self.use_git_worktrees: return - symlink_files = self.shareable_files[:] - symlink_dirs = self.shareable_dirs[:] - to_symlink = symlink_files + symlink_dirs - for name in set(to_symlink): + for name in self.shareable_dirs: # Try to self-heal a bit in simple cases. dst_path = os.path.join(destdir, name) src_path = os.path.join(srcdir, name) @@ -2680,9 +2676,8 @@ class Project(object): copy_all: If true, copy all remaining files from |gitdir| -> |dotgit|. This saves you the effort of initializing |dotgit| yourself. """ - symlink_files = self.shareable_files[:] symlink_dirs = self.shareable_dirs[:] - to_symlink = symlink_files + symlink_dirs + to_symlink = symlink_dirs to_copy = [] if copy_all: @@ -2710,11 +2705,6 @@ class Project(object): elif os.path.isfile(src): shutil.copy(src, dst) - # If the source file doesn't exist, ensure the destination - # file doesn't either. - if name in symlink_files and not os.path.lexists(src): - platform_utils.remove(dst, missing_ok=True) - except OSError as e: if e.errno == errno.EPERM: raise DownloadError(self._get_symlink_error_message())