protected function countGitChangesPerFileRange(Project $project, $file, $from, $to)
    {
        $options = [
          'log',
          '--format=format:qacommit: %H',
          '--no-patch',
          '-L',
          "$from,$to:$file",
        ];

        $existingResults = $this->shell->exec('git', $options, [0], $project->baseDir);

        return count(
            array_filter(
                array_map(
                    'trim',
                    explode(PHP_EOL, $existingResults)
                ),
                function ($line) {
                    return (strpos($line, 'qacommit: ') === 0);
                }
            )
        );
    }
protected function countGitChangesPerFileRange(Project $project, $file, $from, $to)
    {
        $options = [
          'log',
          '--format=format:qacommit: %H',
          '--no-patch',
          '-L',
          "$from,$to:$file",
        ];

        $existingResults = $this->shell->exec('git', $options, [0], $project->baseDir);

        return count(
            array_filter(
                array_map(
                    'trim',
                    explode(PHP_EOL, $existingResults)
                ),
                function ($line) {
                    return (strpos($line, 'qacommit: ') === 0);
                }
            )
        );
    }
protected function countGitChangesPerFileRange ( Project $ project , $ file , $ from , $ to ) { $ options = [ 'log' , '--format=format:qacommit: %H' , '--no-patch' , '-L' , "$from,$to:$file" , ] ; $ existingResults = $ this -> shell -> exec ( 'git' , $ options , [ 0 ] , $ project -> baseDir ) ; return count ( array_filter ( array_map ( 'trim' , explode ( PHP_EOL , $ existingResults ) ) , function ( $ line ) { return ( strpos ( $ line , 'qacommit: ' ) === 0 ) ; } ) ) ; }
Counts GIT commits per file and range. This is used to track the number
of commits on methods or classes.

@HACK: I did not manage to convice GIT to omit the diff when using `-L…`
– this is why we embed the "qacommit: " string and count its occurence
afterwards. This causes GIT to calculate MANY diffs, which are the
passed to PHP and thrown away using many string operations. This sucks.

@FIX : Can be fixed immediately when we learn how to convince GIT to omit
the diffs / patches.
Counts GIT commits per file and range . This is used to track the number of commits on methods or classes .