public function getCurrentBranch($projectRoot)
    {
        $result = Shell::execute('(cd {projectRoot}; {binPath} branch)', [
            '{binPath}' => $this->binPath,
            '{projectRoot}' => $projectRoot,
        ]);
        foreach ($result->outputLines as $line) {
            if (($pos = stripos($line, '* ')) === 0) {
                return trim(substr($line, $pos + 2));
            }
        }
        throw new Exception('Unable to detect current GIT branch: ' . $result->toString());
    }
public function getCurrentBranch($projectRoot)
    {
        $result = Shell::execute('(cd {projectRoot}; {binPath} branch)', [
            '{binPath}' => $this->binPath,
            '{projectRoot}' => $projectRoot,
        ]);
        foreach ($result->outputLines as $line) {
            if (($pos = stripos($line, '* ')) === 0) {
                return trim(substr($line, $pos + 2));
            }
        }
        throw new Exception('Unable to detect current GIT branch: ' . $result->toString());
    }
public function getCurrentBranch ( $ projectRoot ) { $ result = Shell :: execute ( '(cd {projectRoot}; {binPath} branch)' , [ '{binPath}' => $ this -> binPath , '{projectRoot}' => $ projectRoot , ] ) ; foreach ( $ result -> outputLines as $ line ) { if ( ( $ pos = stripos ( $ line , '* ' ) ) === 0 ) { return trim ( substr ( $ line , $ pos + 2 ) ) ; } } throw new Exception ( 'Unable to detect current GIT branch: ' . $ result -> toString ( ) ) ; }
Returns currently active GIT branch name for the project.
@param string $projectRoot VCS project root directory path.
@return string branch name.
@throws Exception on failure.
Returns currently active GIT branch name for the project .