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
Kazuhiko Shiozaki
gitlab-ce
Commits
839aae0e
Commit
839aae0e
authored
Nov 19, 2015
by
Jeroen Nijhof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added housekeeping status and moved path check to gitlab-shell
parent
4f0a38f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+7
-2
app/services/projects/housekeeping_service.rb
app/services/projects/housekeeping_service.rb
+2
-4
No files found.
app/controllers/projects_controller.rb
View file @
839aae0e
...
@@ -8,7 +8,7 @@ class ProjectsController < ApplicationController
...
@@ -8,7 +8,7 @@ class ProjectsController < ApplicationController
before_action
:assign_ref_vars
,
:tree
,
only:
[
:show
],
if: :repo_exists?
before_action
:assign_ref_vars
,
:tree
,
only:
[
:show
],
if: :repo_exists?
# Authorize
# Authorize
before_action
:authorize_admin_project!
,
only:
[
:edit
,
:update
]
before_action
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:housekeeping
]
before_action
:event_filter
,
only:
[
:show
,
:activity
]
before_action
:event_filter
,
only:
[
:show
,
:activity
]
layout
:determine_layout
layout
:determine_layout
...
@@ -172,9 +172,14 @@ class ProjectsController < ApplicationController
...
@@ -172,9 +172,14 @@ class ProjectsController < ApplicationController
end
end
def
housekeeping
def
housekeeping
::
Projects
::
HousekeepingService
.
new
(
@project
).
execute
status
=
::
Projects
::
HousekeepingService
.
new
(
@project
).
execute
respond_to
do
|
format
|
respond_to
do
|
format
|
if
status
flash
[
:notice
]
=
"Housekeeping finished successfully."
else
flash
[
:alert
]
=
"Housekeeping failed."
end
format
.
html
{
redirect_to
project_path
(
@project
)
}
format
.
html
{
redirect_to
project_path
(
@project
)
}
end
end
end
end
...
...
app/services/projects/housekeeping_service.rb
View file @
839aae0e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
# Used for git housekeeping
# Used for git housekeeping
#
#
# Ex.
# Ex.
# Projects::HousekeepingService.new(project
, user
).execute
# Projects::HousekeepingService.new(project).execute
#
#
module
Projects
module
Projects
class
HousekeepingService
<
BaseService
class
HousekeepingService
<
BaseService
...
@@ -14,9 +14,7 @@ module Projects
...
@@ -14,9 +14,7 @@ module Projects
end
end
def
execute
def
execute
if
gitlab_shell
.
exists?
(
@project
.
path_with_namespace
+
'.git'
)
gitlab_shell
.
gc
(
@project
.
path_with_namespace
)
gitlab_shell
.
gc
(
@project
.
path_with_namespace
)
end
end
end
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