Skip to content

Instantly share code, notes, and snippets.

@BenEddy
Last active December 25, 2016 12:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenEddy/7df12b3308a6a8dfc057 to your computer and use it in GitHub Desktop.
Save BenEddy/7df12b3308a6a8dfc057 to your computer and use it in GitHub Desktop.
function capture_profile {
git checkout --quiet --force $commit_sha
echo 'gem "rspec_profiling", group: [:development, :test]' >> Gemfile
bundle install --quiet
echo 'require "rspec_profiling/rspec"' >> spec/rails_helper.rb
rake db:test:prepare
rspec spec
}
function every_nth_commit {
git rev-list --no-merges master |
awk -v n="$1" 'NR == 1 || NR % n == 0'
}
every_nth_commit 10 | # Change 10 to whatever you're into
head -n 1 |
while read commit_sha;
do capture_profile
done```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment