Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 13th, 2012  |  syntax: None  |  size: 0.32 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/env ruby
  2.  
  3. grep = `git grep -n #{ARGV[0]} #{ARGV[1]}`
  4.  
  5. files = grep.scan /.*\:\d+/
  6.  
  7. interrupt = false
  8.  
  9. files.each do |file_with_line|
  10.   exit if interrupt
  11.  
  12.   puts ">>> #{file_with_line}"
  13.   file, line = file_with_line.split(':')
  14.   system "git blame -L #{line} #{file} | head -n 1"
  15.  
  16.   trap('INT'){interrupt = true}
  17.  
  18. end