diff --git a/project.py b/project.py index 8fed8f5e..48cf08c6 100644 --- a/project.py +++ b/project.py @@ -464,7 +464,13 @@ class RemoteSpec(object): class Project(object): # These objects can be shared between several working trees. - shareable_dirs = ['hooks', 'rr-cache'] + @property + def shareable_dirs(self): + """Return the shareable directories""" + if self.UseAlternates: + return ['hooks', 'rr-cache'] + else: + return ['hooks', 'objects', 'rr-cache'] def __init__(self, manifest, @@ -594,6 +600,14 @@ class Project(object): self.bare_ref = GitRefs(self.gitdir) self.bare_objdir = self._GitGetByExec(self, bare=True, gitdir=self.objdir) + @property + def UseAlternates(self): + """Whether git alternates are in use. + + This will be removed once migration to alternates is complete. + """ + return _ALTERNATES or self.manifest.is_multimanifest + @property def Derived(self): return self.is_derived @@ -1147,7 +1161,7 @@ class Project(object): self._UpdateHooks(quiet=quiet) self._InitRemote() - if _ALTERNATES or self.manifest.is_multimanifest: + if self.UseAlternates: # If gitdir/objects is a symlink, migrate it from the old layout. gitdir_objects = os.path.join(self.gitdir, 'objects') if platform_utils.islink(gitdir_objects):