summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-07-22 16:34:27 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-07-23 08:47:36 +0000
commit282b1092e78f1dbe38ada9269d825920c88cb210 (patch)
tree159c26c1bbf9736d47f92b730ef12b09a4e878d9
parentc7124c3d49c3c7616b093b28bcd97404390644a8 (diff)
downloadbuildstream-282b1092e78f1dbe38ada9269d825920c88cb210.tar.gz
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
-rw-r--r--buildstream/plugins/sources/git.py8
1 files 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],