Skip to content

Instantly share code, notes, and snippets.

@grosser
Created Jan 11, 2012
Embed
What would you like to do?
git autobisect because bisect is too complicated....
@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