private function getAllFilesFromGit($git)
    {
        $gitDir = $git->getRepositoryPath();
        // Sadly no command in our git library for this.
        $arguments = [
            $git->getConfig()->getGitExecutablePath(),
            'ls-tree',
            'HEAD',
            '-r',
            '--full-name',
            '--name-only'
        ];

        $process = new Process($this->prepareProcessArguments($arguments), $git->getRepositoryPath());

        $git->getConfig()->getLogger()->debug(
            \sprintf('[ccabs-repository-git] exec [%s] %s', $process->getWorkingDirectory(), $process->getCommandLine())
        );

        $process->run();
        $output = \rtrim($process->getOutput(), "\r\n");

        if (!$process->isSuccessful()) {
            throw GitException::createFromProcess('Could not execute git command', $process);
        }

        $files = [];
        foreach (\explode(PHP_EOL, $output) as $file) {
            $absolutePath = $gitDir . '/' . $file;
            if (!$this->config->isPathExcluded($absolutePath)) {
                $files[\trim($absolutePath)] = \trim($absolutePath);
            }
        }

        return $files;
    }
private function getAllFilesFromGit($git)
    {
        $gitDir = $git->getRepositoryPath();
        // Sadly no command in our git library for this.
        $arguments = [
            $git->getConfig()->getGitExecutablePath(),
            'ls-tree',
            'HEAD',
            '-r',
            '--full-name',
            '--name-only'
        ];

        $process = new Process($this->prepareProcessArguments($arguments), $git->getRepositoryPath());

        $git->getConfig()->getLogger()->debug(
            \sprintf('[ccabs-repository-git] exec [%s] %s', $process->getWorkingDirectory(), $process->getCommandLine())
        );

        $process->run();
        $output = \rtrim($process->getOutput(), "\r\n");

        if (!$process->isSuccessful()) {
            throw GitException::createFromProcess('Could not execute git command', $process);
        }

        $files = [];
        foreach (\explode(PHP_EOL, $output) as $file) {
            $absolutePath = $gitDir . '/' . $file;
            if (!$this->config->isPathExcluded($absolutePath)) {
                $files[\trim($absolutePath)] = \trim($absolutePath);
            }
        }

        return $files;
    }
private function getAllFilesFromGit ( $ git ) { $ gitDir = $ git -> getRepositoryPath ( ) ; // Sadly no command in our git library for this. $ arguments = [ $ git -> getConfig ( ) -> getGitExecutablePath ( ) , 'ls-tree' , 'HEAD' , '-r' , '--full-name' , '--name-only' ] ; $ process = new Process ( $ this -> prepareProcessArguments ( $ arguments ) , $ git -> getRepositoryPath ( ) ) ; $ git -> getConfig ( ) -> getLogger ( ) -> debug ( \ sprintf ( '[ccabs-repository-git] exec [%s] %s' , $ process -> getWorkingDirectory ( ) , $ process -> getCommandLine ( ) ) ) ; $ process -> run ( ) ; $ output = \ rtrim ( $ process -> getOutput ( ) , "\r\n" ) ; if ( ! $ process -> isSuccessful ( ) ) { throw GitException :: createFromProcess ( 'Could not execute git command' , $ process ) ; } $ files = [ ] ; foreach ( \ explode ( PHP_EOL , $ output ) as $ file ) { $ absolutePath = $ gitDir . '/' . $ file ; if ( ! $ this -> config -> isPathExcluded ( $ absolutePath ) ) { $ files [ \ trim ( $ absolutePath ) ] = \ trim ( $ absolutePath ) ; } } return $ files ; }
Retrieve a list of all files within a git repository.

@param GitRepository $git The repository to extract all files from.

@return string[]

@throws GitException When the git execution failed.
@throws \ReflectionException Thrown if the class does not exist.
Retrieve a list of all files within a git repository .