Commit 3ed4a1b3 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

HasLocalBranches check is done by Gitaly only

Closes https://gitlab.com/gitlab-org/gitaly/issues/217
parent 89ab32c6
......@@ -235,18 +235,6 @@ module Gitlab
# This refs by default not visible in project page and not cloned to client side.
alias_method :has_visible_content?, :has_local_branches?
def has_local_branches_rugged?
rugged.branches.each(:local).any? do |ref|
begin
ref.name && ref.target # ensures the branch is valid
true
rescue Rugged::ReferenceError
false
end
end
end
# Returns the number of valid tags
def tag_count
gitaly_migrate(:tag_names) do |is_enabled|
......@@ -1573,12 +1561,8 @@ module Gitlab
private
def uncached_has_local_branches?
gitaly_migrate(:has_local_branches, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled
wrapped_gitaly_errors do
gitaly_repository_client.has_local_branches?
else
has_local_branches_rugged?
end
end
end
......
......@@ -425,7 +425,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
describe '#has_local_branches?' do
shared_examples 'check for local branches' do
context 'check for local branches' do
it { expect(repository.has_local_branches?).to eq(true) }
context 'mutable' do
......@@ -459,14 +459,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
end
context 'with gitaly' do
it_behaves_like 'check for local branches'
end
context 'without gitaly', :skip_gitaly_mock do
it_behaves_like 'check for local branches'
end
end
describe "#delete_branch" do
......
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