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
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+4
-0
app/models/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
...
@@ -57,6 +57,10 @@ class ProjectsController < Projects::ApplicationController
limit
=
(
params
[
:limit
]
||
20
).
to_i
limit
=
(
params
[
:limit
]
||
20
).
to_i
@events
=
@project
.
events
.
recent
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
@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
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
if
@project
.
empty_repo?
if
@project
.
empty_repo?
...
...
app/models/project.rb
View file @
d0a95c30
...
@@ -312,7 +312,7 @@ class Project < ActiveRecord::Base
...
@@ -312,7 +312,7 @@ class Project < ActiveRecord::Base
def
discover_default_branch
def
discover_default_branch
# Discover the default branch, but only if it hasn't already been set to
# Discover the default branch, but only if it hasn't already been set to
# something else
# something else
if
repository
&&
default_branch
.
nil?
if
repository
.
exists?
&&
default_branch
.
nil?
update_attributes
(
default_branch:
self
.
repository
.
discover_default_branch
)
update_attributes
(
default_branch:
self
.
repository
.
discover_default_branch
)
end
end
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