public function getCommit(Environment $environment, $sha = null)
    {
        $sha = $this->normalizeSha($environment, $sha);
        if ($sha === null) {
            return false;
        }

        $parents = $this->parseParents($sha);
        $sha = preg_replace('/[\^~].*$/', '', $sha);

        // Get the first commit.
        $commit = $this->getCommitByShaHash($environment, $sha);
        if (!$commit) {
            return false;
        }

        // Fetch parent commits recursively.
        while ($commit !== false && count($parents)) {
            $parent = array_shift($parents);
            if (isset($commit->parents[$parent - 1])) {
                $commit = $this->getCommitByShaHash($environment, $commit->parents[$parent - 1]);
            } else {
                return false;
            }
        }

        return $commit;
    }
public function getCommit(Environment $environment, $sha = null)
    {
        $sha = $this->normalizeSha($environment, $sha);
        if ($sha === null) {
            return false;
        }

        $parents = $this->parseParents($sha);
        $sha = preg_replace('/[\^~].*$/', '', $sha);

        // Get the first commit.
        $commit = $this->getCommitByShaHash($environment, $sha);
        if (!$commit) {
            return false;
        }

        // Fetch parent commits recursively.
        while ($commit !== false && count($parents)) {
            $parent = array_shift($parents);
            if (isset($commit->parents[$parent - 1])) {
                $commit = $this->getCommitByShaHash($environment, $commit->parents[$parent - 1]);
            } else {
                return false;
            }
        }

        return $commit;
    }
public function getCommit ( Environment $ environment , $ sha = null ) { $ sha = $ this -> normalizeSha ( $ environment , $ sha ) ; if ( $ sha === null ) { return false ; } $ parents = $ this -> parseParents ( $ sha ) ; $ sha = preg_replace ( '/[\^~].*$/' , '' , $ sha ) ; // Get the first commit. $ commit = $ this -> getCommitByShaHash ( $ environment , $ sha ) ; if ( ! $ commit ) { return false ; } // Fetch parent commits recursively. while ( $ commit !== false && count ( $ parents ) ) { $ parent = array_shift ( $ parents ) ; if ( isset ( $ commit -> parents [ $ parent - 1 ] ) ) { $ commit = $ this -> getCommitByShaHash ( $ environment , $ commit -> parents [ $ parent - 1 ] ) ; } else { return false ; } } return $ commit ; }
Get a Git Commit object for an environment.

@param \Platformsh\Client\Model\Environment $environment
@param string|null                          $sha

@return \Platformsh\Client\Model\Git\Commit|false
Get a Git Commit object for an environment .