HasLocalBranches check is done by Gitaly only
Closes https://gitlab.com/gitlab-org/gitaly/issues/217
This commit is contained in:
parent
89ab32c6b2
commit
3ed4a1b3aa
2 changed files with 3 additions and 27 deletions
|
@ -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
|
||||
gitaly_repository_client.has_local_branches?
|
||||
else
|
||||
has_local_branches_rugged?
|
||||
end
|
||||
wrapped_gitaly_errors do
|
||||
gitaly_repository_client.has_local_branches?
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue