Fix symlinking of new projects

We weren't copying these lists, so the += was actually changing the
underlying lists.

When a new project was added to the manifest, we run _CheckDirReference
against the manifest project with share_refs=True, which added the
working_tree_* to the shareable_* lists. Then, when we load the new
manifest and create the new project, it uses the lists that already
contain the working_tree_* files, even though we passed
share_refs=False.

This happens reliably under the above conditions, but doesn't seem to
happen when syncing a fresh tree. So we've got a mixture of links that
may need to be cleaned up later. This patch will just stop it from
happening in the future.

Change-Id: Ib7935bfad78af1e494a75e55134ec829f13c2a41
This commit is contained in:
Dan Willemsen 2016-04-05 17:22:02 -07:00
parent e121ad558d
commit bdb866ea76

View File

@ -2315,8 +2315,8 @@ class Project(object):
self.bare_git.symbolic_ref('-m', msg, ref, dst) self.bare_git.symbolic_ref('-m', msg, ref, dst)
def _CheckDirReference(self, srcdir, destdir, share_refs): def _CheckDirReference(self, srcdir, destdir, share_refs):
symlink_files = self.shareable_files symlink_files = self.shareable_files[:]
symlink_dirs = self.shareable_dirs symlink_dirs = self.shareable_dirs[:]
if share_refs: if share_refs:
symlink_files += self.working_tree_files symlink_files += self.working_tree_files
symlink_dirs += self.working_tree_dirs symlink_dirs += self.working_tree_dirs
@ -2344,8 +2344,8 @@ class Project(object):
copy_all: If true, copy all remaining files from |gitdir| -> |dotgit|. copy_all: If true, copy all remaining files from |gitdir| -> |dotgit|.
This saves you the effort of initializing |dotgit| yourself. This saves you the effort of initializing |dotgit| yourself.
""" """
symlink_files = self.shareable_files symlink_files = self.shareable_files[:]
symlink_dirs = self.shareable_dirs symlink_dirs = self.shareable_dirs[:]
if share_refs: if share_refs:
symlink_files += self.working_tree_files symlink_files += self.working_tree_files
symlink_dirs += self.working_tree_dirs symlink_dirs += self.working_tree_dirs