Skip to content

Commit

Permalink
Change "/" for DIRECTORY_SEPARATOR to Windows - OK
Browse files Browse the repository at this point in the history
This way the --report-gitblame works on windows as well.

The former way it always thrown the following error:
`ERROR: Could not locate .git directory`
  • Loading branch information
rogeriopradoj committed Nov 8, 2012
1 parent 33c6012 commit f1d063f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CodeSniffer/Reports/Gitblame.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ protected function getBlameContent($filename)
echo 'Getting GIT blame info for '.basename($filename).'... ';
}

$fileParts = explode('/', $filename);
$fileParts = explode(DIRECTORY_SEPARATOR, $filename);
$found = false;
$location = '';
while (empty($fileParts) === false) {
array_pop($fileParts);
$location = implode($fileParts, '/');
if (is_dir($location.'/.git') === true) {
$location = implode($fileParts, DIRECTORY_SEPARATOR);
if (is_dir($location . DIRECTORY_SEPARATOR.'.git') === true) {
$found = true;
break;
}
Expand Down

0 comments on commit f1d063f

Please sign in to comment.