Commit 7ac24140 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Refactor empty? to call only Gitaly endpoints

Needed for the Gitaly migration, see
https://gitlab.com/gitlab-org/gitaly/issues/699
parent 77f5f723
......@@ -76,9 +76,6 @@ module Gitlab
@attributes = Gitlab::Git::Attributes.new(path)
end
delegate :empty?,
to: :rugged
def ==(other)
path == other.path
end
......@@ -197,6 +194,10 @@ module Gitlab
end
end
def empty?
!exists? || !has_local_branches?
end
def has_local_branches?
gitaly_migrate(:has_local_branches) do |is_enabled|
if is_enabled
......
......@@ -27,7 +27,7 @@ module Gitlab
end
SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION'.freeze
MAXIMUM_GITALY_CALLS = 30
MAXIMUM_GITALY_CALLS = 35
CLIENT_NAME = (Sidekiq.server? ? 'gitlab-sidekiq' : 'gitlab-web').freeze
MUTEX = Mutex.new
......
......@@ -257,7 +257,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
describe '#empty?' do
it { expect(repository.empty?).to be_falsey }
it { expect(repository).not_to be_empty }
end
describe '#ref_names' 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