Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
c192444d
Commit
c192444d
authored
Oct 20, 2015
by
Artem V. Navrotskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show empty repository page if repository don't have branches
parent
d25b50fd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
CHANGELOG
CHANGELOG
+1
-0
app/models/project.rb
app/models/project.rb
+1
-1
app/models/repository.rb
app/models/repository.rb
+13
-0
No files found.
CHANGELOG
View file @
c192444d
...
@@ -88,6 +88,7 @@ v 8.0.5
...
@@ -88,6 +88,7 @@ v 8.0.5
- Correct lookup-by-email for LDAP logins
- Correct lookup-by-email for LDAP logins
- Fix loading spinner sometimes not being hidden on Merge Request tab switches
- Fix loading spinner sometimes not being hidden on Merge Request tab switches
- Animate the logo on hover
- Animate the logo on hover
- Show "Empty Repository Page" for repository without branches (#9728)
v 8.0.4
v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
...
...
app/models/project.rb
View file @
c192444d
...
@@ -567,7 +567,7 @@ class Project < ActiveRecord::Base
...
@@ -567,7 +567,7 @@ class Project < ActiveRecord::Base
end
end
def
empty_repo?
def
empty_repo?
!
repository
.
exists?
||
repository
.
empty
?
!
repository
.
exists?
||
!
repository
.
has_visible_content
?
end
end
def
repo
def
repo
...
...
app/models/repository.rb
View file @
c192444d
...
@@ -44,6 +44,19 @@ class Repository
...
@@ -44,6 +44,19 @@ class Repository
raw_repository
.
empty?
raw_repository
.
empty?
end
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'
)
def
commit
(
id
=
'HEAD'
)
return
nil
unless
raw_repository
return
nil
unless
raw_repository
commit
=
Gitlab
::
Git
::
Commit
.
find
(
raw_repository
,
id
)
commit
=
Gitlab
::
Git
::
Commit
.
find
(
raw_repository
,
id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment