Merge branch 'bozaro-empty-repo'

This commit is contained in:
Douwe Maan
2015-10-22 10:25:57 +02:00
3 changed files with 15 additions and 1 deletions
+1
View File
@@ -10,6 +10,7 @@ v 8.2.0 (unreleased)
- Adds ability to remove the forked relationship from project settings screen. (Han Loong Liauw)
- Improved performance of sorting milestone issues
- Allow users to select the Files view as default project view (Cristian Bica)
- Show "Empty Repository Page" for repository without branches (Artem V. Navrotskiy)
v 8.1.0 (unreleased)
- Send an email to admin email when a user is reported for spam (Jonathan Rochkind)
+1 -1
View File
@@ -567,7 +567,7 @@ class Project < ActiveRecord::Base
end
def empty_repo?
!repository.exists? || repository.empty?
!repository.exists? || !repository.has_visible_content?
end
def repo
+13
View File
@@ -44,6 +44,19 @@ class Repository
raw_repository.empty?
end
#
# Git repository can contains some hidden refs like:
# /refs/notes/*
# /refs/git-as-svn/*
# /refs/pulls/*
# This refs by default not visible in project page and not cloned to client side.
#
# This method return true if repository contains some content visible in project page.
#
def has_visible_content?
!raw_repository.branches.empty?
end
def commit(id = 'HEAD')
return nil unless raw_repository
commit = Gitlab::Git::Commit.find(raw_repository, id)