in src/buildstream_plugins/sources/git.py [0:0]
def stage(self, directory):
fullpath = os.path.join(directory, self.path)
# 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),
fail_temporarily=True,
)
self.source.call(
[self.source.host_git, "checkout", "--force", self.ref],
fail="Failed to checkout git ref {}".format(self.ref),
cwd=fullpath,
)
# Remove .git dir
shutil.rmtree(os.path.join(fullpath, ".git"))
self._rebuild_git(fullpath)