summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/projects_controller.rb9
-rw-r--r--app/services/projects/housekeeping_service.rb6
2 files changed, 9 insertions, 6 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index c3efdffe563..27b723fae6a 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -8,7 +8,7 @@ class ProjectsController < ApplicationController
before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists?
# 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]
layout :determine_layout
@@ -172,9 +172,14 @@ class ProjectsController < ApplicationController
end
def housekeeping
- ::Projects::HousekeepingService.new(@project).execute
+ status = ::Projects::HousekeepingService.new(@project).execute
respond_to do |format|
+ if status
+ flash[:notice] = "Housekeeping finished successfully."
+ else
+ flash[:alert] = "Housekeeping failed."
+ end
format.html { redirect_to project_path(@project) }
end
end
diff --git a/app/services/projects/housekeeping_service.rb b/app/services/projects/housekeeping_service.rb
index 48875ac3449..bea91b5f180 100644
--- a/app/services/projects/housekeeping_service.rb
+++ b/app/services/projects/housekeeping_service.rb
@@ -3,7 +3,7 @@
# Used for git housekeeping
#
# Ex.
-# Projects::HousekeepingService.new(project, user).execute
+# Projects::HousekeepingService.new(project).execute
#
module Projects
class HousekeepingService < BaseService
@@ -14,9 +14,7 @@ module Projects
end
def execute
- if gitlab_shell.exists?(@project.path_with_namespace + '.git')
- gitlab_shell.gc(@project.path_with_namespace)
- end
+ gitlab_shell.gc(@project.path_with_namespace)
end
end
end