Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/git_stats/git_data/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module GitData
class Author
include HashInitializable

attr_reader :repo, :name, :email
attr_reader :repo, :name

def commits
@commits ||= repo.commits.select { |commit| commit.author == self }
Expand Down Expand Up @@ -55,11 +55,11 @@ def dirname
end

def to_s
"#{self.class} #@name <#@email>"
"#{self.class} #@name"
end

def ==(other)
[self.repo, self.name, self.email] == [other.repo, other.name, other.email]
[self.repo, self.name] == [other.repo, other.name]
end

end
Expand Down
8 changes: 4 additions & 4 deletions lib/git_stats/git_data/command_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def parse(command, result)

def parse_shortlog(result, params)
result.lines.map do |line|
commits, name, email = line.scan(/(.*)\t(.*)<(.*)>/).first.map(&:strip)
{commits: commits.to_i, name: name, email: email}
commits, name = line.scan(/(.*)\t(.*)/).first.map(&:strip)
{commits: commits.to_i, name: name}
end
end

Expand All @@ -23,8 +23,8 @@ def parse_ls_tree(result, params)

def parse_rev_list(result, params)
result.lines.map do |line|
sha, stamp, date, author_email = line.split('|').map(&:strip)
{sha: sha, stamp: stamp, date: date, author_email: author_email}
sha, stamp, date, author_name = line.split('|').map(&:strip)
{sha: sha, stamp: stamp, date: date, author_name: author_name}
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/git_stats/git_data/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ def initialize(params)
end

def authors
@authors ||= run_and_parse("git shortlog -se #{commit_range}").map do |author|
Author.new(repo: self, name: author[:name], email: author[:email])
@authors ||= run_and_parse("git shortlog -s #{commit_range}").map do |author|
Author.new(repo: self, name: author[:name])
end.extend(ByFieldFinder)
end

def commits
@commits ||= run_and_parse("git rev-list --pretty=format:'%h|%at|%ai|%aE' #{commit_range} | grep -v commit").map do |commit_line|
@commits ||= run_and_parse("git rev-list --pretty=format:'%h|%at|%ai|%aN' #{commit_range} | grep -v commit").map do |commit_line|
Commit.new(
repo: self,
sha: commit_line[:sha],
stamp: commit_line[:stamp],
date: DateTime.parse(commit_line[:date]),
author: authors.by_email(commit_line[:author_email])
author: authors.by_name(commit_line[:author_name])
)
end.sort_by! { |e| e.date }.extend(ByFieldFinder)
end
Expand Down
4 changes: 2 additions & 2 deletions templates/activity/_activity.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.tab-pane.active
.page-header.pagination-centered
%h1= page.t
%h3= "#{author.respond_to?(:name) ? author.name : ""} #{author.respond_to?(:email) ? "&lt;#{author.email}&gt;" : ""}"
%h3= author.respond_to?(:name) ? author.name : ""
- if page == :activity_by_date
= high_stock("charts.activity_by_date", charts.activity_by_date(author))

Expand Down Expand Up @@ -98,4 +98,4 @@
%tr
%th= year
- (1..12).each do |month|
%td= months[month]
%td= months[month]
2 changes: 1 addition & 1 deletion templates/authors/_authors.haml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
- sorted_authors.each_with_index do |author, i|
%tr
%th= i+1
%th= "#{author.name} &lt;#{author.email}&gt;"
%th= "#{author.name}"
%td= author.commits.size
%td= author.insertions
%td= author.deletions
Expand Down