This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit 150fb81e authored by Stan Hu's avatar Stan Hu
Browse files

Remove git refs used internally by GitLab from network graph

Closes #2702
parent ef1f010be4fc
Please view this file on the master branch, on stable branches it's out of date.
v 8.0.1
- Remove git refs used internally by GitLab from network graph (Stan Hu)
- Improve CI migration procedure and documentation
v 8.0.0
module GraphHelper
def get_refs(repo, commit)
refs = ""
refs << commit.ref_names(repo).join(' ')
# 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[]}]" if @graph.notes[] > 0
require 'spec_helper'
describe GraphHelper do
describe '#get_refs' do
let(:project) { create(:project) }
let(:commit) { project.commit("master") }
let(:graph) {, 'master', commit, '') }
it 'filter our refs used by GitLab' do
allow(commit).to receive(:ref_names).and_return(['refs/merge-requests/abc', 'master', 'refs/tmp/xyz'])
self.instance_variable_set(:@graph, graph)
refs = get_refs(project.repository, commit)
expect(refs).to eq('master')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment