/** * @param string $repo * @param string $branch * @param string $destination */ public function checkout($repo, $branch, $destination) { $this->ioService->writeln("<info>Checkout out {$repo} to {$destination}</info>"); $repo = escapeshellarg($repo); $branch = escapeshellarg($branch); $destination = escapeshellarg($destination); $this->gitUtil->run("clone --progress -b {$branch} {$repo} {$destination}"); }
/** * @param string $branch * @param string $cloneUrl * @param string $absPath * @param string $pluginName */ private function installPlugin($branch, $cloneUrl, $absPath, $pluginName) { $this->gitUtil->run("clone --progress {$cloneUrl} {$absPath}"); if ($branch) { $this->gitUtil->run("-C {$absPath} checkout {$branch}"); } $branch = $branch ?: 'master'; $this->ioService->writeln("Successfully checked out '{$branch}' for '{$pluginName}'\n"); }
/** * @param string $branch * @param string $cloneUrl * @param string $absPath * @param string $pluginName */ private function installPlugin($branch, $cloneUrl, $absPath, $pluginName) { $this->gitUtil->run("clone --progress {$cloneUrl} {$absPath}"); if ($branch) { // the CWD change is a fix for older versions of GIT which do not support the -C flag $cwd = getcwd(); $this->utilities->changeDir($absPath); $this->gitUtil->run("checkout {$branch}"); $this->utilities->changeDir($cwd); } $branch = $branch ?: 'master'; $this->ioService->writeln("Successfully checked out '{$branch}' for '{$pluginName}'\n"); }