src/Scrutinizer/Util/DiffUtils.php
public static function diff($repositoryPath, $baseSha, $headSha, array $paths = array())
    {
        $proc = new Process(sprintf('cd %s && git diff %s %s -- %s',
                    escapeshellarg($repositoryPath),
                    escapeshellarg($baseSha),
                    escapeshellarg($headSha),
                    implode(' ', array_map('escapeshellarg', $paths))));

        if (0 !== $proc->run()) {
            throw new ProcessFailedException($proc);
        }

        return self::parseDiffs($proc->getOutput());
    }
public static function diff($repositoryPath, $baseSha, $headSha, array $paths = array())
    {
        $proc = new Process(sprintf('cd %s && git diff %s %s -- %s',
                    escapeshellarg($repositoryPath),
                    escapeshellarg($baseSha),
                    escapeshellarg($headSha),
                    implode(' ', array_map('escapeshellarg', $paths))));

        if (0 !== $proc->run()) {
            throw new ProcessFailedException($proc);
        }

        return self::parseDiffs($proc->getOutput());
    }
This is more or less a port of https://github.com/mojombo/grit/blob/master/lib/grit/diff.rb