mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-28 22:16:15 +10:00
Merge branch 'fix-network-graph-refs' into 'master'
Remove git refs used internally by GitLab from network graph GitLab 8.0 removed satellites and started using git refs that began with `refs/merge-requests/XXX` and `refs/tmp/XXX`, which showed up in an ugly way in the network graph:  Closes #2702 See merge request !1410
This commit is contained in:
@@ -15,6 +15,7 @@ v 8.0.2 (unreleased)
|
||||
- Fix LDAP attribute mapping
|
||||
|
||||
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
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
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[commit.id]}]" if @graph.notes[commit.id] > 0
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe GraphHelper do
|
||||
describe '#get_refs' do
|
||||
let(:project) { create(:project) }
|
||||
let(:commit) { project.commit("master") }
|
||||
let(:graph) { Network::Graph.new(project, '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')
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user