in src/buildstream_plugins/sources/git.py [0:0]
def init_workspace(self, directory):
fullpath = os.path.join(directory, self.path)
url = self.source.translate_url(self.url)
self.source.call(
[
self.source.host_git,
"clone",
"--no-checkout",
self.mirror,
fullpath,
],
fail="Failed to clone git mirror {} in directory: {}".format(self.mirror, fullpath),
fail_temporarily=True,
)
self.source.call(
[self.source.host_git, "remote", "set-url", "origin", url],
fail='Failed to add remote origin "{}"'.format(url),
cwd=fullpath,
)
self.source.call(
[self.source.host_git, "checkout", "--force", self.ref],
fail="Failed to checkout git ref {}".format(self.ref),
cwd=fullpath,
)