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 --- README.md | 4 ++++ lib/gitlab_projects.rb | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 462bdc8..383c521 100644 --- a/README.md +++ b/README.md @@ -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 -- cgit v1.2.1 From f487dcb07538d917a3c002694bb160b5900e85be Mon Sep 17 00:00:00 2001 From: Jeroen Nijhof Date: Thu, 19 Nov 2015 15:16:04 +0100 Subject: Check if path exists for gc --- lib/gitlab_projects.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 0497502..461819a 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -250,6 +250,10 @@ class GitlabProjects 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 -- cgit v1.2.1 From 6632bd275454e012ff962800449173b032e959c0 Mon Sep 17 00:00:00 2001 From: Jeroen Nijhof Date: Mon, 4 Jan 2016 14:37:13 +0100 Subject: Version bumped to 2.6.10 --- CHANGELOG | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 75617dd..b15af33 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +v2.6.10 + - Add git gc for housekeeping + v2.6.9 - Remove trailing slashes from gitlab_url diff --git a/VERSION b/VERSION index d48d370..a04abec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.9 +2.6.10 -- cgit v1.2.1