housekeeping_service.rb 460 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Projects::HousekeepingService class
#
# Used for git housekeeping
#
# Ex.
#   Projects::HousekeepingService.new(project, user).execute
#
module Projects
  class HousekeepingService < BaseService
    include Gitlab::ShellAdapter

    def initialize(project)
      @project = project
    end

    def execute
      if gitlab_shell.exists?(@project.path_with_namespace + '.git')
        gitlab_shell.gc(@project.path_with_namespace)
      end
    end
  end
end