diff options
author | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2015-10-21 15:13:18 +0200 |
---|---|---|
committer | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2015-10-21 15:13:18 +0200 |
commit | d2b77063675b25513b9af8d6a3521c429732552f (patch) | |
tree | 0381ff65fbc24685a09ca1bd52c46453cde10075 | |
parent | fccdcc071b8ea20b282e1a092ef014f0b2ad8181 (diff) | |
download | gitlab-shell-d2b77063675b25513b9af8d6a3521c429732552f.tar.gz |
Added git gc for housekeeping
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | lib/gitlab_projects.rb | 13 |
2 files changed, 14 insertions, 3 deletions
@@ -121,6 +121,10 @@ Remove tag: ./bin/gitlab-projects rm-tag gitlab/gitlab-ci.git v3.0.0 +Gc repo: + + ./bin/gitlab-projects gc gitlab/gitlab-ci.git + ## Keys Add key: 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 |