summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-11-16 21:06:58 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-12-08 19:28:55 +0100
commite0b5306cb79c7a535f96c0d2d864278b2193d641 (patch)
tree4d141c89bd9191e4bbf45d1418f06a6c03fa45b9
parent96a0a8cfb62d9ea66ee2a22e09a116d64f333703 (diff)
downloadgitlab-ce-e0b5306cb79c7a535f96c0d2d864278b2193d641.tar.gz
Remove Repository#find_ref
-rw-r--r--app/models/repository.rb10
-rw-r--r--spec/models/repository_spec.rb36
2 files changed, 0 insertions, 46 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 10635eb0cf4..35dd120856d 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -182,16 +182,6 @@ class Repository
tags.find { |tag| tag.name == name }
end
- def find_ref(ref)
- if Gitlab::Git.tag_ref?(ref)
- find_tag(Gitlab::Git.ref_name(ref))
- elsif Gitlab::Git.branch_ref?(ref)
- find_branch(Gitlab::Git.ref_name(ref))
- else
- nil
- end
- end
-
def add_branch(user, branch_name, ref)
branch = raw_repository.add_branch(branch_name, user: user, target: ref)
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 6f9fdcf4482..f09b4b67061 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -1699,42 +1699,6 @@ describe Repository do
end
end
- describe '#find_ref' do
- subject { repository.find_ref(ref) }
-
- context 'when ref is a tag' do
- let(:ref) { 'refs/tags/v1.0.0' }
-
- it 'returns a tag' do
- is_expected.to be_a(Gitlab::Git::Tag)
- end
-
- it 'returns the correct tag' do
- expect(subject.name).to eq('v1.0.0')
- end
- end
-
- context 'when ref is a branch' do
- let(:ref) { 'refs/heads/master' }
-
- it 'returns a branch' do
- is_expected.to be_a(Gitlab::Git::Branch)
- end
-
- it 'returns the correct branch' do
- expect(subject.name).to eq('master')
- end
- end
-
- context 'when ref is invalid' do
- let(:ref) { 'refs/notvalid/ref' }
-
- it 'returns nil' do
- is_expected.to eq(nil)
- end
- end
- end
-
describe '#avatar' do
it 'returns nil if repo does not exist' do
allow(repository).to receive(:root_ref).and_raise(Gitlab::Git::Repository::NoRepository)