Created
January 11, 2012 22:54
-
-
Save grosser/1597288 to your computer and use it in GitHub Desktop.
git autobisect because bisect is too complicated....
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@command = ARGV.join(' ') | |
if system @command | |
raise "Everything is fine here..." | |
end | |
def sh(cmd) | |
puts cmd | |
IO.popen(cmd) do |pipe| | |
while str = pipe.gets | |
puts str | |
end | |
end | |
$?.success? | |
end | |
def find_any_good_commit | |
commits = `git log --oneline | head -n 100`.split("\n").map{|c|c.split(' ').first} | |
current = 1 | |
loop do | |
commit = commits[current] | |
sh "git checkout #{commit}" | |
if system @command | |
puts "everything ok at #{commit}" | |
return commit | |
else | |
puts "#{commit} is bad" | |
end | |
current = current * 2 | |
end | |
end | |
good = find_any_good_commit | |
sh "git co master" | |
sh "git bisect reset" | |
sh "git bisect start" | |
sh "git bisect bad" | |
sh "git co #{good}" | |
sh "git bisect good" | |
exec "git bisect run #{@command}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment