Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-01-25 12:35:54 +0300
committerDouwe Maan <douwe@gitlab.com>2016-01-25 12:35:54 +0300
commit0f2a906211dcbf4978b465d342521dda14ade729 (patch)
tree601af1737f9424d416ae1f16cea9a1f727479541
parent07ee83932fb755f4e0c89ba3bf172a6ae728d601 (diff)
parent0689663487c66d21aa83da0830bc2c042f89e6e8 (diff)
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
-rw-r--r--Gemfile.lock2
-rw-r--r--app/models/repository.rb2
-rw-r--r--spec/models/repository_spec.rb20
3 files changed, 22 insertions, 2 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index 5e0718af70f..47b6f4852c7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -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)
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 9e8bd91fde9..6c1ee4b29cd 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -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')
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index afbf62035ac..c484ae8fc8c 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -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