diff options
author | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2016-01-04 14:32:13 +0100 |
---|---|---|
committer | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2016-01-04 14:32:13 +0100 |
commit | b1d8db4f53318fcc1f75745bbc5ef0a360a0c896 (patch) | |
tree | bb3f3ecc9f2751a1921a17895edc3e963d0b43d6 | |
parent | 962f7a312623e8ab34efeaf098701c89e633b68c (diff) | |
parent | f487dcb07538d917a3c002694bb160b5900e85be (diff) | |
download | gitlab-shell-b1d8db4f53318fcc1f75745bbc5ef0a360a0c896.tar.gz |
Merge branch 'master' of https://gitlab.com/jnijhof/gitlab-shell
Conflicts:
lib/gitlab_projects.rb
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | lib/gitlab_projects.rb | 15 |
2 files changed, 17 insertions, 2 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 67fd298..c1d175a 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -55,12 +55,13 @@ 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 'fetch-remote'; fetch_remote when 'update-head'; update_head + when 'gc'; gc else $logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}." puts 'not allowed' @@ -275,4 +276,14 @@ 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}>." + unless File.exists?(full_path) + $logger.error "gc failed: destination path <#{full_path}> does not exist." + return false + end + cmd = %W(git --git-dir=#{full_path} gc) + system(*cmd) + end end |