From d2b77063675b25513b9af8d6a3521c429732552f Mon Sep 17 00:00:00 2001 From: Jeroen Nijhof Date: Wed, 21 Oct 2015 15:13:18 +0200 Subject: Added git gc for housekeeping --- lib/gitlab_projects.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/gitlab_projects.rb') diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 8bf000d..0497502 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -55,11 +55,12 @@ class GitlabProjects when 'rm-tag'; rm_tag when 'add-project'; add_project when 'list-projects'; puts list_projects - when 'rm-project'; rm_project - when 'mv-project'; mv_project + when 'rm-project'; rm_project + when 'mv-project'; mv_project when 'import-project'; import_project when 'fork-project'; fork_project - when 'update-head'; update_head + when 'update-head'; update_head + when 'gc'; gc else $logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}." puts 'not allowed' @@ -246,4 +247,10 @@ class GitlabProjects $logger.info "Update head in project #{project_name} to <#{new_head}>." true end + + def gc + $logger.info "Running git gc for <#{full_path}>." + cmd = %W(git --git-dir=#{full_path} gc) + system(*cmd) + end end -- cgit v1.2.1