From 2705f38a7be07a34a3638fbbd2d6ab7cded1765e Mon Sep 17 00:00:00 2001 From: Tracy Rotton Date: Thu, 21 Nov 2024 09:44:19 -0500 Subject: [PATCH] local:clone - adding "--branch" option to specify cloning a particular multidev branch (#2648) * local:clone - adding "--branch" option to specify cloning a particular git (multidev) branch * Per Pantheon engineer request: Modified the options to make "master" the default value, then always assigning $devBranch to that value, whether specified or not. --- src/Commands/Local/CloneCommand.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Commands/Local/CloneCommand.php b/src/Commands/Local/CloneCommand.php index 3f35d996c..382174765 100644 --- a/src/Commands/Local/CloneCommand.php +++ b/src/Commands/Local/CloneCommand.php @@ -37,19 +37,18 @@ class CloneCommand extends TerminusCommand implements SiteAwareInterface, Config * * @option site_dir Custom directory for the local copy. By default, the site name is used * @option override Override the local copy if exists + * @option branch The branch to clone. Default is master * * @usage Clone's a local copy into "$HOME/pantheon-local-copies" */ - public function clone(string $site_id, array $options = ['site_dir' => null, 'override' => null]): string + public function clone(string $site_id, array $options = ['site_dir' => null, 'override' => null, 'branch' => 'master']): string { $site = $this->getSiteById($site_id); $env = $site->getEnvironments()->get('dev'); $gitUrl = $env->connectionInfo()['git_url'] ?? null; $localCopyDir = $site->getLocalCopyDir($options['site_dir'] ?? null); - - // @todo This value should come from somewhere else. - $devBranch = 'master'; + $devBranch = $options['branch']; try { /** @var \Pantheon\Terminus\Helpers\LocalMachineHelper $localMachineHelper */