Commit 38348aa1 authored by Matija Čupić's avatar Matija Čupić

Remove Gitlab::Git::Ref#full_ref

parent 2b4883e0
......@@ -1755,13 +1755,11 @@ class Project < ActiveRecord::Base
resolved_ref = resolve_ref(ref)
return false unless resolved_ref
full_ref = resolved_ref.full_ref
ref_name = resolved_ref.name
if Gitlab::Git.branch_ref?(full_ref)
ProtectedBranch.protected?(self, ref_name)
elsif Gitlab::Git.tag_ref?(full_ref)
ProtectedTag.protected?(self, ref_name)
case resolved_ref
when Gitlab::Git::Branch
ProtectedBranch.protected?(self, resolved_ref.name)
when Gitlab::Git::Tag
ProtectedTag.protected?(self, resolved_ref.name)
end
end
......
......@@ -54,11 +54,11 @@ module Gitlab
end
def tag_ref?(ref)
ref =~ %r{#{TAG_REF_PREFIX}\w+}
ref =~ /#{TAG_REF_PREFIX}\w+/
end
def branch_ref?(ref)
ref =~ %r{#{BRANCH_REF_PREFIX}\w+}
ref =~ /#{BRANCH_REF_PREFIX}\w+/
end
def blank_ref?(ref)
......
......@@ -28,10 +28,6 @@ module Gitlab
def state
active? ? :active : :stale
end
def full_ref
Gitlab::Git::BRANCH_REF_PREFIX + name
end
end
end
end
......@@ -39,10 +39,6 @@ module Gitlab
nil
end
end
def full_ref
raise NotImplementedError
end
end
end
end
......@@ -62,10 +62,6 @@ module Gitlab
encode! @message
end
def full_ref
Gitlab::Git::TAG_REF_PREFIX + name
end
private
def message_from_gitaly_tag
......
......@@ -124,18 +124,6 @@ describe Gitlab::Git::Branch, :seed_helper do
it { expect(repository.branches.size).to eq(SeedRepo::Repo::BRANCHES.size) }
describe '#full_ref' do
subject do
described_class.new(repository, 'master',
repository.commit.sha,
repository.commit).full_ref
end
it 'returns the full ref' do
is_expected.to eq('refs/heads/master')
end
end
def create_commit
params[:message].delete!("\r")
Rugged::Commit.create(rugged, params.merge(committer: committer.merge(time: Time.now)))
......
......@@ -69,17 +69,4 @@ describe Gitlab::Git::Tag, :seed_helper do
end
end
end
describe '#full_ref' do
subject do
described_class.new(repository, { name: 'master',
target: repository.commit.sha,
target_commit: repository.commit })
.full_ref
end
it 'returns the full ref' do
is_expected.to eq('refs/tags/master')
end
end
end
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