Skip to content

Commit

Permalink
local:clone - adding "--branch" option to specify cloning a particula…
Browse files Browse the repository at this point in the history
…r 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.
  • Loading branch information
taupecat authored Nov 21, 2024
1 parent 2669769 commit 2705f38
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Commands/Local/CloneCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <site> 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 */
Expand Down

0 comments on commit 2705f38

Please sign in to comment.