src/Composer/Repository/Vcs/GitDriver.php
public function getRootIdentifier()
    {
        if (null === $this->rootIdentifier) {
            $this->rootIdentifier = 'master';

            // select currently checked out branch if master is not available
            $this->process->execute('git branch --no-color', $output, $this->repoDir);
            $branches = $this->process->splitLines($output);
            if (!in_array('* master', $branches)) {
                foreach ($branches as $branch) {
                    if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
                        $this->rootIdentifier = $match[1];
                        break;
                    }
                }
            }
        }

        return $this->rootIdentifier;
    }
public function getRootIdentifier()
    {
        if (null === $this->rootIdentifier) {
            $this->rootIdentifier = 'master';

            // select currently checked out branch if master is not available
            $this->process->execute('git branch --no-color', $output, $this->repoDir);
            $branches = $this->process->splitLines($output);
            if (!in_array('* master', $branches)) {
                foreach ($branches as $branch) {
                    if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
                        $this->rootIdentifier = $match[1];
                        break;
                    }
                }
            }
        }

        return $this->rootIdentifier;
    }
public function getRootIdentifier ( ) { if ( null === $ this -> rootIdentifier ) { $ this -> rootIdentifier = 'master' ; // select currently checked out branch if master is not available $ this -> process -> execute ( 'git branch --no-color' , $ output , $ this -> repoDir ) ; $ branches = $ this -> process -> splitLines ( $ output ) ; if ( ! in_array ( '* master' , $ branches ) ) { foreach ( $ branches as $ branch ) { if ( $ branch && preg_match ( '{^\* +(\S+)}' , $ branch , $ match ) ) { $ this -> rootIdentifier = $ match [ 1 ] ; break ; } } } } return $ this -> rootIdentifier ; }
{@inheritDoc}
{