summaryrefslogtreecommitdiff
path: root/app/models/graph/commit.rb
diff options
context:
space:
mode:
authorSato Hiroyuki <sathiroyuki@gmail.com>2013-02-27 22:37:38 +0900
committerSato Hiroyuki <sathiroyuki@gmail.com>2013-02-28 11:44:40 +0900
commit38fce3deb03904fdfcf2fe512b094d49e22fe61c (patch)
tree517537335fb000a44875ce8007ea18d147cc1e3b /app/models/graph/commit.rb
parentf11e855bdb7f4026a4ec4c553ce7308b9bf71a0a (diff)
downloadgitlab-ce-38fce3deb03904fdfcf2fe512b094d49e22fe61c.tar.gz
It improves detecting an overlap of a line
Diffstat (limited to 'app/models/graph/commit.rb')
-rw-r--r--app/models/graph/commit.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/models/graph/commit.rb b/app/models/graph/commit.rb
index 2b09d53902a..742a73b38b7 100644
--- a/app/models/graph/commit.rb
+++ b/app/models/graph/commit.rb
@@ -4,12 +4,12 @@ module Graph
class Commit
include ActionView::Helpers::TagHelper
- attr_accessor :time, :space, :refs, :parent_spaces
+ attr_accessor :time, :spaces, :refs, :parent_spaces
def initialize(commit)
@_commit = commit
@time = -1
- @space = 0
+ @spaces = []
@parent_spaces = []
end
@@ -27,7 +27,7 @@ module Graph
email: author.email
}
h[:time] = time
- h[:space] = space
+ h[:space] = spaces.first
h[:parent_spaces] = parent_spaces
h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil?
h[:id] = sha
@@ -46,5 +46,13 @@ module Graph
@refs = ref_cache[@_commit.id] if ref_cache.include?(@_commit.id)
@refs ||= []
end
+
+ def space
+ if @spaces.size > 0
+ @spaces.first
+ else
+ 0
+ end
+ end
end
end