diff options
author | Mike Frysinger <vapier@google.com> | 2021-12-20 18:16:33 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2022-01-10 17:41:40 +0000 |
commit | d33dce0b773dae95987c337c5f84007d0cdd2b0e (patch) | |
tree | 729decaf9a8b50941f2e4540632785321d2d2594 /project.py | |
parent | 89ed8acdbe468fd76d531cd8b7b2ace5b414f0bd (diff) | |
download | git-repo-d33dce0b773dae95987c337c5f84007d0cdd2b0e.tar.gz |
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 <jackneus@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -457,7 +457,6 @@ class RemoteSpec(object): | |||
457 | 457 | ||
458 | class Project(object): | 458 | class Project(object): |
459 | # These objects can be shared between several working trees. | 459 | # These objects can be shared between several working trees. |
460 | shareable_files = [] | ||
461 | shareable_dirs = ['hooks', 'objects', 'rr-cache'] | 460 | shareable_dirs = ['hooks', 'objects', 'rr-cache'] |
462 | 461 | ||
463 | def __init__(self, | 462 | def __init__(self, |
@@ -2651,10 +2650,7 @@ class Project(object): | |||
2651 | if self.use_git_worktrees: | 2650 | if self.use_git_worktrees: |
2652 | return | 2651 | return |
2653 | 2652 | ||
2654 | symlink_files = self.shareable_files[:] | 2653 | for name in self.shareable_dirs: |
2655 | symlink_dirs = self.shareable_dirs[:] | ||
2656 | to_symlink = symlink_files + symlink_dirs | ||
2657 | for name in set(to_symlink): | ||
2658 | # Try to self-heal a bit in simple cases. | 2654 | # Try to self-heal a bit in simple cases. |
2659 | dst_path = os.path.join(destdir, name) | 2655 | dst_path = os.path.join(destdir, name) |
2660 | src_path = os.path.join(srcdir, name) | 2656 | src_path = os.path.join(srcdir, name) |
@@ -2680,9 +2676,8 @@ class Project(object): | |||
2680 | copy_all: If true, copy all remaining files from |gitdir| -> |dotgit|. | 2676 | copy_all: If true, copy all remaining files from |gitdir| -> |dotgit|. |
2681 | This saves you the effort of initializing |dotgit| yourself. | 2677 | This saves you the effort of initializing |dotgit| yourself. |
2682 | """ | 2678 | """ |
2683 | symlink_files = self.shareable_files[:] | ||
2684 | symlink_dirs = self.shareable_dirs[:] | 2679 | symlink_dirs = self.shareable_dirs[:] |
2685 | to_symlink = symlink_files + symlink_dirs | 2680 | to_symlink = symlink_dirs |
2686 | 2681 | ||
2687 | to_copy = [] | 2682 | to_copy = [] |
2688 | if copy_all: | 2683 | if copy_all: |
@@ -2710,11 +2705,6 @@ class Project(object): | |||
2710 | elif os.path.isfile(src): | 2705 | elif os.path.isfile(src): |
2711 | shutil.copy(src, dst) | 2706 | shutil.copy(src, dst) |
2712 | 2707 | ||
2713 | # If the source file doesn't exist, ensure the destination | ||
2714 | # file doesn't either. | ||
2715 | if name in symlink_files and not os.path.lexists(src): | ||
2716 | platform_utils.remove(dst, missing_ok=True) | ||
2717 | |||
2718 | except OSError as e: | 2708 | except OSError as e: |
2719 | if e.errno == errno.EPERM: | 2709 | if e.errno == errno.EPERM: |
2720 | raise DownloadError(self._get_symlink_error_message()) | 2710 | raise DownloadError(self._get_symlink_error_message()) |