diff options
author | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2015-11-19 15:16:54 +0100 |
---|---|---|
committer | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2015-11-19 15:16:54 +0100 |
commit | 839aae0e473e85042f76391b44eaeb099235a813 (patch) | |
tree | c01e81d58b26b574b1a325933af8158cfdd7cdc4 | |
parent | 4f0a38f1a833cab8c83e77a6c5d323057883188d (diff) | |
download | gitlab-ce-839aae0e473e85042f76391b44eaeb099235a813.tar.gz |
Added housekeeping status and moved path check to gitlab-shell
-rw-r--r-- | app/controllers/projects_controller.rb | 9 | ||||
-rw-r--r-- | app/services/projects/housekeeping_service.rb | 6 |
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 |