/hooks/prepare-commit-msg

http://github.com/fizx/parsley · Ruby · 16 lines · 11 code · 0 blank · 5 comment · 0 complexity · b920ec76582ce82659f88eb36d958459 MD5 · raw file

  1. #!/usr/bin/env ruby
  2. #
  3. # I use this to track performance regressions in my commit messages. To
  4. # use, copy or symlink into .git/hooks.
  5. #
  6. message = File.read(ARGV[0]).strip
  7. require "benchmark"
  8. File.open(ARGV[0], "w") do |file|
  9. ROOT = File.dirname(__FILE__) + "/../../"
  10. system "cd #{ROOT} && make check"
  11. status = $?.success? ? "passing" : "failing"
  12. time = Benchmark.measure {
  13. system "cd #{ROOT} && make bench && make bench && make bench"
  14. }.real
  15. file.printf "%s (%s) [%4f]", message, status, time
  16. end