public
Description: Gitorious aims to provide a great way of doing distributed opensource code collaboration.
Homepage: http://gitorious.org/projects/gitorious
Clone URL: git://github.com/dysinger/gitorious.git
Fixed Repository#commit_graph_data_by_author edge case of the commit count 
being nil when multiple "authors" with the same name have different 
emails
js (author)
Mon May 19 14:16:41 -0700 2008
commit  205f5f1283c5ed1ed2471a616b449dae08ab616b
tree    8df9b064bfbb9d8b08c93b601c18ef57ac82feaa
parent  5e61707eeed61828047c8ba882e04fa694ede4f4
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
 
 
 
 
 
 
197
198
199
200
201
202
 
 
 
203
204
205
...
181
182
183
 
184
185
 
 
 
 
 
 
 
 
 
 
186
187
188
189
190
191
192
193
194
195
196
 
197
198
199
200
201
202
0
@@ -181,25 +181,22 @@ class Repository < ActiveRecord::Base
0
   def commit_graph_data_by_author(head = "master")
0
     h = {}
0
     emails = {}
0
- count_author_regexp = /^\s+(\d+)\s(.+)\s\<(\S+)\>$/.freeze
0
     data = self.git.git.shortlog({:e => true, :s => true }, head)
0
     data.each_line do |line|
0
- if line =~ count_author_regexp
0
- count = $1.to_i
0
- author = $2
0
- email = $3
0
-
0
- h[author] ||= 0
0
- h[author] += count
0
-
0
- emails[email] = author
0
- end
0
+ count, actor = line.split("\t")
0
+ actor = Grit::Actor.from_string(actor)
0
+
0
+ h[actor.name] ||= 0
0
+ h[actor.name] += count.to_i
0
+ emails[actor.email] = actor.name
0
     end
0
     
0
     users = User.find(:all, :conditions => ["email in (?)", emails.keys])
0
     users.each do |user|
0
       author_name = emails[user.email]
0
- h[user.login] = h.delete(author_name)
0
+ if h[author_name] # in the event that a user with the same name has used two different emails, he'd be gone by now
0
+ h[user.login] = h.delete(author_name)
0
+ end
0
     end
0
     
0
     h

Comments

    No one has commented yet.