summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2018-07-12 18:06:31 +0200
committerJacob Vosmaer <jacob@gitlab.com>2018-07-12 18:06:31 +0200
commit9d93a61a70f5f5af12a880e0ca7f4ec6575152f9 (patch)
tree722a8beb48111b6f0eaab7ee103c9d06f6536917
parent40ed88b78412c9598293dbc3b12e3d7c65e12c23 (diff)
downloadgitlab-ce-gitaly-mandatory-20180712-jv.tar.gz
Fix find_branch call sitesgitaly-mandatory-20180712-jv
-rw-r--r--app/models/repository.rb4
-rw-r--r--lib/gitlab/git/repository.rb2
-rw-r--r--spec/models/repository_spec.rb18
3 files changed, 3 insertions, 21 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 5ed2a7b4068..a96c73e6ab7 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -174,8 +174,8 @@ class Repository
CommitCollection.new(project, commits, ref)
end
- def find_branch(name, fresh_repo: true)
- raw_repository.find_branch(name, fresh_repo)
+ def find_branch(name)
+ raw_repository.find_branch(name)
end
def find_tag(name)
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index d4dcfd47d0c..fc4711751b1 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1114,7 +1114,7 @@ module Gitlab
end
def can_be_merged?(source_sha, target_branch)
- if target_sha = find_branch(target_branch, true)&.target
+ if target_sha = find_branch(target_branch)&.target
!gitaly_conflicts_client(source_sha, target_sha).conflicts?
else
false
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 04d00023b8a..02d31098cfd 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -1022,24 +1022,6 @@ describe Repository do
end
end
- describe '#find_branch' do
- context 'fresh_repo is true' do
- it 'delegates the call to raw_repository' do
- expect(repository.raw_repository).to receive(:find_branch).with('master', true)
-
- repository.find_branch('master', fresh_repo: true)
- end
- end
-
- context 'fresh_repo is false' do
- it 'delegates the call to raw_repository' do
- expect(repository.raw_repository).to receive(:find_branch).with('master', false)
-
- repository.find_branch('master', fresh_repo: false)
- end
- end
- end
-
describe '#update_branch_with_hooks' do
let(:old_rev) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } # git rev-parse feature
let(:new_rev) { 'a74ae73c1ccde9b974a70e82b901588071dc142a' } # commit whose parent is old_rev