Commit c192444d authored by Artem V. Navrotskiy's avatar Artem V. Navrotskiy

Show empty repository page if repository don't have branches

parent d25b50fd
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
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