BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d0a95c30
Commit
d0a95c30
authored
Aug 15, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure project discover default branch on Project#show
parent
20c65f3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
projects_controller.rb
app/controllers/projects_controller.rb
+4
-0
project.rb
app/models/project.rb
+1
-1
No files found.
app/controllers/projects_controller.rb
View file @
d0a95c30
...
...
@@ -57,6 +57,10 @@ class ProjectsController < Projects::ApplicationController
limit
=
(
params
[
:limit
]
||
20
).
to_i
@events
=
@project
.
events
.
recent
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
# Ensure project default branch is set if it possible
# Normally it defined on push or during creation
@project
.
discover_default_branch
respond_to
do
|
format
|
format
.
html
do
if
@project
.
empty_repo?
...
...
app/models/project.rb
View file @
d0a95c30
...
...
@@ -312,7 +312,7 @@ class Project < ActiveRecord::Base
def
discover_default_branch
# Discover the default branch, but only if it hasn't already been set to
# something else
if
repository
&&
default_branch
.
nil?
if
repository
.
exists?
&&
default_branch
.
nil?
update_attributes
(
default_branch:
self
.
repository
.
discover_default_branch
)
end
end
...
...
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