diff options
author | LaMont Jones <lamontjones@google.com> | 2022-06-07 18:24:20 +0000 |
---|---|---|
committer | LaMont Jones <lamontjones@google.com> | 2022-06-08 16:49:08 +0000 |
commit | 68d69635c7bfef6ed8a5c7e29246265611471e0f (patch) | |
tree | 7f7596cac2127f973b787a3eecd645bfbcf149ee /project.py | |
parent | ff6b1dae1e9f2e7405690c1aeedf7e0c7d768460 (diff) | |
download | git-repo-68d69635c7bfef6ed8a5c7e29246265611471e0f.tar.gz |
Fix Projects.shareable_dirsv2.27
If this tree is not using alternates for object sharing, then we need to
continue to call it a shared directory.
Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=15982
Test: manual
Change-Id: I1750f10b192504ac67f552222f8ddb9809d344fe
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/338974
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -464,7 +464,13 @@ class RemoteSpec(object): | |||
464 | 464 | ||
465 | class Project(object): | 465 | class Project(object): |
466 | # These objects can be shared between several working trees. | 466 | # These objects can be shared between several working trees. |
467 | shareable_dirs = ['hooks', 'rr-cache'] | 467 | @property |
468 | def shareable_dirs(self): | ||
469 | """Return the shareable directories""" | ||
470 | if self.UseAlternates: | ||
471 | return ['hooks', 'rr-cache'] | ||
472 | else: | ||
473 | return ['hooks', 'objects', 'rr-cache'] | ||
468 | 474 | ||
469 | def __init__(self, | 475 | def __init__(self, |
470 | manifest, | 476 | manifest, |
@@ -595,6 +601,14 @@ class Project(object): | |||
595 | self.bare_objdir = self._GitGetByExec(self, bare=True, gitdir=self.objdir) | 601 | self.bare_objdir = self._GitGetByExec(self, bare=True, gitdir=self.objdir) |
596 | 602 | ||
597 | @property | 603 | @property |
604 | def UseAlternates(self): | ||
605 | """Whether git alternates are in use. | ||
606 | |||
607 | This will be removed once migration to alternates is complete. | ||
608 | """ | ||
609 | return _ALTERNATES or self.manifest.is_multimanifest | ||
610 | |||
611 | @property | ||
598 | def Derived(self): | 612 | def Derived(self): |
599 | return self.is_derived | 613 | return self.is_derived |
600 | 614 | ||
@@ -1147,7 +1161,7 @@ class Project(object): | |||
1147 | self._UpdateHooks(quiet=quiet) | 1161 | self._UpdateHooks(quiet=quiet) |
1148 | self._InitRemote() | 1162 | self._InitRemote() |
1149 | 1163 | ||
1150 | if _ALTERNATES or self.manifest.is_multimanifest: | 1164 | if self.UseAlternates: |
1151 | # If gitdir/objects is a symlink, migrate it from the old layout. | 1165 | # If gitdir/objects is a symlink, migrate it from the old layout. |
1152 | gitdir_objects = os.path.join(self.gitdir, 'objects') | 1166 | gitdir_objects = os.path.join(self.gitdir, 'objects') |
1153 | if platform_utils.islink(gitdir_objects): | 1167 | if platform_utils.islink(gitdir_objects): |