summaryrefslogtreecommitdiff
path: root/app/helpers/graph_helper.rb
blob: 1e372d5631d78377ecfda7cab4d9b5b16ca42765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module GraphHelper
  def get_refs(repo, commit)
    refs = ""
    # Commit::ref_names already strips the refs/XXX from important refs (e.g. refs/heads/XXX)
    # so anything leftover is internally used by GitLab
    commit_refs = commit.ref_names(repo).reject{ |name| name.starts_with?('refs/') }
    refs << commit_refs.join(' ')

    # append note count
    refs << "[#{@graph.notes[commit.id]}]" if @graph.notes[commit.id] > 0

    refs
  end

  def parents_zip_spaces(parents, parent_spaces)
    ids = parents.map { |p| p.id }
    ids.zip(parent_spaces)
  end
end