Method: GitStats::GitData::Repo#commits

Defined in:
lib/git_stats/git_data/repo.rb

#commitsObject



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/git_stats/git_data/repo.rb', line 49

def commits
  command = "git rev-list --pretty=format:'%H|%at|%ai|%aE' #{commit_range} #{tree_path} | grep -v commit"
  @commits ||= run_and_parse(command).map do |commit_line|
    Commit.new(
      repo: self,
      sha: commit_line[:sha],
      stamp: commit_line[:stamp],
      date: Time.parse(commit_line[:date]),
      author: authors.first! { |a| a.email == commit_line[:author_email] }
    )
  end.sort_by!(&:date)
end