Merge branch 'update-gitlab-git' into 'master'

Update gitlab_git & use new method for counting branches

Corresponding gitlab_git merge request detailing some of the rationale behind this: https://gitlab.com/gitlab-org/gitlab_git/merge_requests/62

Fixes #12418 

See merge request !2535
This commit is contained in:
Douwe Maan 2016-01-25 09:35:54 +00:00
commit 0f2a906211
3 changed files with 22 additions and 2 deletions

View file

@ -356,7 +356,7 @@ GEM
posix-spawn (~> 0.3)
gitlab_emoji (0.2.0)
gemojione (~> 2.1)
gitlab_git (7.2.23)
gitlab_git (7.2.24)
activesupport (~> 4.0)
charlock_holmes (~> 0.7.3)
github-linguist (~> 4.7.0)

View file

@ -57,7 +57,7 @@ class Repository
# This method return true if repository contains some content visible in project page.
#
def has_visible_content?
!raw_repository.branches.empty?
raw_repository.branch_count > 0
end
def commit(id = 'HEAD')

View file

@ -219,4 +219,24 @@ describe Repository, models: true do
end
end
end
describe '#has_visible_content?' do
subject { repository.has_visible_content? }
describe 'when there are no branches' do
before do
allow(repository.raw_repository).to receive(:branch_count).and_return(0)
end
it { is_expected.to eq(false) }
end
describe 'when there are branches' do
before do
allow(repository.raw_repository).to receive(:branch_count).and_return(3)
end
it { is_expected.to eq(true) }
end
end
end