protected function getCurrentUserInfo($git)
    {
        // Sadly no command in our git library for this.
        $arguments = [
            $git->getConfig()->getGitExecutablePath(),
            'config',
            '--get-regexp',
            'user.[name|email]'
        ];

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

        $git->getConfig()->getLogger()->debug(
            \sprintf('[git-php] 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);
        }

        $config = array();
        foreach (\explode(PHP_EOL, $output) as $line) {
            list($name, $value)   = \explode(' ', $line, 2);
            $config[\trim($name)] = \trim($value);
        }

        if (isset($config['user.name']) && $config['user.email']) {
            return \sprintf('%s <%s>', $config['user.name'], $config['user.email']);
        }

        return '';
    }
protected function getCurrentUserInfo($git)
    {
        // Sadly no command in our git library for this.
        $arguments = [
            $git->getConfig()->getGitExecutablePath(),
            'config',
            '--get-regexp',
            'user.[name|email]'
        ];

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

        $git->getConfig()->getLogger()->debug(
            \sprintf('[git-php] 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);
        }

        $config = array();
        foreach (\explode(PHP_EOL, $output) as $line) {
            list($name, $value)   = \explode(' ', $line, 2);
            $config[\trim($name)] = \trim($value);
        }

        if (isset($config['user.name']) && $config['user.email']) {
            return \sprintf('%s <%s>', $config['user.name'], $config['user.email']);
        }

        return '';
    }
protected function getCurrentUserInfo ( $ git ) { // Sadly no command in our git library for this. $ arguments = [ $ git -> getConfig ( ) -> getGitExecutablePath ( ) , 'config' , '--get-regexp' , 'user.[name|email]' ] ; $ process = new Process ( $ this -> prepareProcessArguments ( $ arguments ) , $ git -> getRepositoryPath ( ) ) ; $ git -> getConfig ( ) -> getLogger ( ) -> debug ( \ sprintf ( '[git-php] 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 ) ; } $ config = array ( ) ; foreach ( \ explode ( PHP_EOL , $ output ) as $ line ) { list ( $ name , $ value ) = \ explode ( ' ' , $ line , 2 ) ; $ config [ \ trim ( $ name ) ] = \ trim ( $ value ) ; } if ( isset ( $ config [ 'user.name' ] ) && $ config [ 'user.email' ] ) { return \ sprintf ( '%s <%s>' , $ config [ 'user.name' ] , $ config [ 'user.email' ] ) ; } return '' ; }
Retrieve the data of the current user on the system.

@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 the data of the current user on the system .