Skip to content

Instantly share code, notes, and snippets.

@georgebrock
Created October 17, 2012 08:35
Show Gist options
  • Save georgebrock/3904432 to your computer and use it in GitHub Desktop.
Save georgebrock/3904432 to your computer and use it in GitHub Desktop.
git bisect script for Rails issue 7950
date=`git log -n1 --pretty=format:%ai`
cd ../activerecord-deprecated_finders
git checkout `git rev-list -n1 --before="$date" master`
cd ../rails
unset AR_DEPRECATED_FINDERS
grep active_record_deprecated_finders Gemfile && export AR_DEPRECATED_FINDERS=../activerecord-deprecated_finders
export JOURNEY=../journey
cd ../journey
git checkout `git rev-list -n1 --before="$date" master`
cd ../rails
bundle check || bundle install || bundle update
ruby -Iactiverecord/test activerecord/test/cases/temp_test.rb
require 'cases/helper'
require 'models/company'
class TempTest < ActiveRecord::TestCase
def test_included_in_collection_for_new_records
client = Client.create(:name => 'Persisted')
assert_nil client.client_of
# Note the test passes when the bug is present and fails when it is fixed
# git bisect is easier to use this way round
assert Firm.new.clients_of_firm.include?(client)
end
end
# From the root directory of the Rails repo
cd ..
git clone git://github.com/rails/journey.git
git clone git://github.com/rails/activerecord-deprecated_finders.git
cd rails
git checkout `git merge-base origin/master origin/3-2-stable`
git bisect start HEAD origin/master
git bisect run ./bisecttest.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment