Fix tests fail cause of issue with grit stub
This commit is contained in:
parent
9014fb7525
commit
2032f4cd96
3 changed files with 19 additions and 12 deletions
|
@ -2,18 +2,18 @@ require "grit"
|
|||
|
||||
module Gitlab
|
||||
class GraphCommit
|
||||
attr_accessor :time, :space
|
||||
attr_accessor :refs
|
||||
attr_accessor :time, :space, :refs
|
||||
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
def self.to_graph(project)
|
||||
@repo = project.repo
|
||||
commits = Grit::Commit.find_all(@repo, nil, {max_count: 650}).dup
|
||||
|
||||
commits = collect_commits(@repo).dup
|
||||
|
||||
ref_cache = {}
|
||||
|
||||
commits.map! {|c| GraphCommit.new(Commit.new(c))}
|
||||
commits.map! { |commit| GraphCommit.new(Commit.new(commit))}
|
||||
commits.each { |commit| commit.add_refs(ref_cache, @repo) }
|
||||
|
||||
days = GraphCommit.index_commits(commits)
|
||||
|
@ -23,6 +23,16 @@ module Gitlab
|
|||
return @days_json, @commits_json
|
||||
end
|
||||
|
||||
# Get commits from repository
|
||||
#
|
||||
def self.collect_commits repo
|
||||
Grit::Commit.find_all(repo, nil, {max_count: self.max_count})
|
||||
end
|
||||
|
||||
def self.max_count
|
||||
@max_count ||= 650
|
||||
end
|
||||
|
||||
# Method is adding time and space on the
|
||||
# list of commits. As well as returns date list
|
||||
# corelated with time set on commits.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue