summaryrefslogtreecommitdiffstats
path: root/git-cc
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-09-29 19:29:54 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-09-29 19:29:54 +0200
commit6af803f4d9df06b06c31ebc907deb106df9c1e9b (patch)
tree1914c1c7eedb37e9bf331b3b025e68f01237ad8f /git-cc
parente11cba2b63aa12c8535e1003ff9731b82f6bff00 (diff)
downloadbin-6af803f4d9df06b06c31ebc907deb106df9c1e9b.tar.gz
bin-6af803f4d9df06b06c31ebc907deb106df9c1e9b.tar.xz
add git-cc
Signed-off-by: Florian Pritz <bluewind@xssn.at>
Diffstat (limited to 'git-cc')
-rwxr-xr-xgit-cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/git-cc b/git-cc
new file mode 100755
index 0000000..1fb4d5c
--- /dev/null
+++ b/git-cc
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+
+@authors = {}
+
+def parse_blame(line)
+ key, value = line.split(" ", 2)
+ case key
+ when "author"
+ @name = value
+ when "author-mail"
+ @mail = value
+ author = "\"#{@name}\" #{@mail}"
+ @authors[author] = true
+ end
+end
+
+ARGV.each do |filename|
+ patch_file = File.open(filename)
+ patch_file.each_line do |patch_line|
+ @from ||= patch_line[/From (\w+)/, 1]
+ case patch_line
+ when /^---\s+(\S+)/
+ @source = $1[2..-1]
+ when /^@@\s-(\d+),(\d+)/
+ blame = `git blame --incremental -L #{$1},+#{$2} #{@source} #{@from}^ | grep author`
+ blame.each_line { |l| parse_blame(l.chomp) }
+ end
+ end
+end
+
+@authors.each_key do |a|
+ puts a
+end \ No newline at end of file