Platformsh\Cli\Helper\GitHelper::setDefaultRepositoryDir PHP Method

setDefaultRepositoryDir() public method

The default is the current working directory.
public setDefaultRepositoryDir ( string $dir )
$dir string The path to a Git repository.
    public function setDefaultRepositoryDir($dir)
    {
        $this->repositoryDir = $dir;
    }

Usage Example

 /**
  * @{inheritdoc}
  *
  * Set up before every test.
  *
  * @throws \Exception
  */
 public function setUp()
 {
     $this->tempDirSetUp();
     $repository = $this->getRepositoryDir();
     if (!is_dir($repository) && !mkdir($repository, 0755, true)) {
         throw new \Exception("Failed to create directories.");
     }
     $this->gitHelper = new GitHelper();
     $this->gitHelper->init($repository, true);
     $this->gitHelper->setDefaultRepositoryDir($repository);
     chdir($repository);
     // Ensure we are on the master branch.
     $this->gitHelper->checkOut('master');
     // Add required Git config before committing.
     shell_exec('git config user.email [email protected]');
     shell_exec('git config user.name "Test"');
     shell_exec('git config commit.gpgsign false');
     // Make a dummy commit so that there is a HEAD.
     touch($repository . '/README.txt');
     shell_exec('git add -A && git commit -qm "Initial commit"');
 }
All Usage Examples Of Platformsh\Cli\Helper\GitHelper::setDefaultRepositoryDir