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