Show empty repository page if repository don't have branches

This commit is contained in:
Artem V. Navrotskiy 2015-10-20 21:47:29 +03:00
parent d25b50fda6
commit c192444db5
3 changed files with 15 additions and 1 deletions

View File

@ -88,6 +88,7 @@ v 8.0.5
- Correct lookup-by-email for LDAP logins
- Fix loading spinner sometimes not being hidden on Merge Request tab switches
- Animate the logo on hover
- Show "Empty Repository Page" for repository without branches (#9728)
v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)

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

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)