mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Fix Projects.shareable_dirs
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>
This commit is contained in:
parent
ff6b1dae1e
commit
68d69635c7
18
project.py
18
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):
|
||||
|
Loading…
Reference in New Issue
Block a user