summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorSato Hiroyuki <sathiroyuki@gmail.com>2013-01-23 21:34:19 +0900
committerGitLab <gitlab@hiroponz.net>2013-01-23 21:39:29 +0900
commit70687cd5812a53ce574589f4f7ce6a6d683c2f07 (patch)
treef51da1a7b48802fe9a15afcc538cd010be29cb53 /lib/gitlab
parent65737bd5bd6eb65556699a176e69757a3ac8c37a (diff)
downloadgitlab-ce-70687cd5812a53ce574589f4f7ce6a6d683c2f07.tar.gz
Improve network graph
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/graph/json_builder.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/graph/json_builder.rb b/lib/gitlab/graph/json_builder.rb
index 4a48b3b5675..a3157aa4b4d 100644
--- a/lib/gitlab/graph/json_builder.rb
+++ b/lib/gitlab/graph/json_builder.rb
@@ -16,6 +16,7 @@ module Gitlab
@commits = collect_commits
@days = index_commits
+ @space = 0
end
def to_json(*args)
@@ -97,8 +98,8 @@ module Gitlab
if leaves.empty?
return
end
- space = find_free_space(leaves, map)
- leaves.each{|l| l.space = space}
+ @space = find_free_space(leaves, map)
+ leaves.each{|l| l.space = @space}
# and mark it as reserved
min_time = leaves.last.time
parents = leaves.last.parents.collect
@@ -115,7 +116,7 @@ module Gitlab
else
max_time = parent_time - 1
end
- mark_reserved(min_time..max_time, space)
+ mark_reserved(min_time..max_time, @space)
# Visit branching chains
leaves.each do |l|
@@ -139,9 +140,10 @@ module Gitlab
reserved += @_reserved[day]
end
space = base_space(leaves, map)
- while reserved.include? space do
+ while (reserved.include? space) || (space == @space) do
space += 1
end
+
space
end