From 282b1092e78f1dbe38ada9269d825920c88cb210 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 22 Jul 2018 16:34:27 +0900 Subject: plugins/sources/git.py: Use --shared instead of --hardlinks This improves staging performance by avoiding making any copies of the objects in the cloned repository in the staging area before removing the .git directory. Fixes #488 --- buildstream/plugins/sources/git.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py index d1ea81763..e68de81cf 100644 --- a/buildstream/plugins/sources/git.py +++ b/buildstream/plugins/sources/git.py @@ -153,10 +153,10 @@ class GitMirror(): def stage(self, directory): fullpath = os.path.join(directory, self.path) - # We need to pass '--no-hardlinks' because there's nothing to - # stop the build from overwriting the files in the .git directory - # inside the sandbox. - self.source.call([self.source.host_git, 'clone', '--no-checkout', '--no-hardlinks', self.mirror, fullpath], + # Using --shared here avoids copying the objects into the checkout, in any + # case we're just checking out a specific commit and then removing the .git/ + # directory. + self.source.call([self.source.host_git, 'clone', '--no-checkout', '--shared', self.mirror, fullpath], fail="Failed to create git mirror {} in directory: {}".format(self.mirror, fullpath)) self.source.call([self.source.host_git, 'checkout', '--force', self.ref], -- cgit v1.2.1