-
-
Save jamesdabbs/7010720 to your computer and use it in GitHub Desktop.
A simple amalgam of git grep and git blame, mostly intended for finding FIXMEs that I introduced (as evidenced by the defaults) before merging them in.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
word = ARGV.shift || "FIXME|TODO" | |
name = ARGV.shift || "James" | |
lines = `git grep -n -E '#{word}'` | |
lines.scan /(.*):(\d+)/ do |file, line| | |
up, down = line.to_i - 2, line.to_i + 5 | |
blame = `git blame -w -L#{up},#{down} #{file}` | |
if blame =~ /#{name}.*(#{word})/ | |
puts "-- #{file} ----->" | |
puts blame | |
puts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment