Skip to content

Instantly share code, notes, and snippets.

@mmenozzi
Created December 19, 2012 08:39
Show Gist options
  • Save mmenozzi/4335325 to your computer and use it in GitHub Desktop.
Save mmenozzi/4335325 to your computer and use it in GitHub Desktop.
Simple PHP script to find out wich commit broke given test command.
<?php
$sinceDate = '11/01/2012'; // Change to fit your needs
$testCommand = 'phpunit src/Symfony/Component/Finder'; // Change to fit your needs
$revlist = array();
exec("git log --since=$sinceDate --branches=master --reverse --pretty=%H | cat", $revlist);
foreach ($revlist as $commit) {
echo "Checking out commit $commit...\r\n";
system("git checkout $commit");
echo "Running tests...\r\n";
$return = null;
system($testCommand, $return);
if ($return !== 0) {
break;
}
}
echo "Blame on $commit !!!\r\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment