public function collectFilesWithCommits(GitRepository $git)
    {
        // git show --format="%H" --quiet
        $lastCommitId = $git->show()->format('%H')->execute('--quiet');
        $cacheId      = \md5(__FUNCTION__ . $lastCommitId);

        if ($this->cachePool->has($cacheId)) {
            $fromCache = $this->cachePool->get($cacheId);

            $this->commitCollection   = $fromCache['commitCollection'];
            $this->filePathMapping    = $fromCache['filePathMapping'];
            $this->filePathCollection = $fromCache['filePathCollection'];

            return;
        }

        $commitCollection   = [];
        $filePathMapping    = [];
        $filePathCollection = [];

        $this->prepareCommitCollection(
            $git,
            $this->fetchAllCommits($git, $lastCommitId),
            $commitCollection,
            $filePathMapping,
            $filePathCollection
        );

        $this->cachePool->set(
            $cacheId,
            [
                'commitCollection'   => $commitCollection,
                'filePathMapping'    => $filePathMapping,
                'filePathCollection' => $filePathCollection
            ]
        );

        $this->commitCollection   = $commitCollection;
        $this->filePathMapping    = $filePathMapping;
        $this->filePathCollection = $filePathCollection;
    }
public function collectFilesWithCommits(GitRepository $git)
    {
        // git show --format="%H" --quiet
        $lastCommitId = $git->show()->format('%H')->execute('--quiet');
        $cacheId      = \md5(__FUNCTION__ . $lastCommitId);

        if ($this->cachePool->has($cacheId)) {
            $fromCache = $this->cachePool->get($cacheId);

            $this->commitCollection   = $fromCache['commitCollection'];
            $this->filePathMapping    = $fromCache['filePathMapping'];
            $this->filePathCollection = $fromCache['filePathCollection'];

            return;
        }

        $commitCollection   = [];
        $filePathMapping    = [];
        $filePathCollection = [];

        $this->prepareCommitCollection(
            $git,
            $this->fetchAllCommits($git, $lastCommitId),
            $commitCollection,
            $filePathMapping,
            $filePathCollection
        );

        $this->cachePool->set(
            $cacheId,
            [
                'commitCollection'   => $commitCollection,
                'filePathMapping'    => $filePathMapping,
                'filePathCollection' => $filePathCollection
            ]
        );

        $this->commitCollection   = $commitCollection;
        $this->filePathMapping    = $filePathMapping;
        $this->filePathCollection = $filePathCollection;
    }
public function collectFilesWithCommits ( GitRepository $ git ) { // git show --format="%H" --quiet $ lastCommitId = $ git -> show ( ) -> format ( '%H' ) -> execute ( '--quiet' ) ; $ cacheId = \ md5 ( __FUNCTION__ . $ lastCommitId ) ; if ( $ this -> cachePool -> has ( $ cacheId ) ) { $ fromCache = $ this -> cachePool -> get ( $ cacheId ) ; $ this -> commitCollection = $ fromCache [ 'commitCollection' ] ; $ this -> filePathMapping = $ fromCache [ 'filePathMapping' ] ; $ this -> filePathCollection = $ fromCache [ 'filePathCollection' ] ; return ; } $ commitCollection = [ ] ; $ filePathMapping = [ ] ; $ filePathCollection = [ ] ; $ this -> prepareCommitCollection ( $ git , $ this -> fetchAllCommits ( $ git , $ lastCommitId ) , $ commitCollection , $ filePathMapping , $ filePathCollection ) ; $ this -> cachePool -> set ( $ cacheId , [ 'commitCollection' => $ commitCollection , 'filePathMapping' => $ filePathMapping , 'filePathCollection' => $ filePathCollection ] ) ; $ this -> commitCollection = $ commitCollection ; $ this -> filePathMapping = $ filePathMapping ; $ this -> filePathCollection = $ filePathCollection ; }
Collect all files with their commits.

@param GitRepository $git The git repository.

@return void
Collect all files with their commits .