summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-01-05 13:41:29 +0000
committerDouwe Maan <douwe@gitlab.com>2016-01-05 13:41:29 +0000
commit82b3a4e8f70692ec679d880628fdb0f5844d42b9 (patch)
tree42ab59c8734600ae165e269c88ed7bd1be9be291
parent962f7a312623e8ab34efeaf098701c89e633b68c (diff)
parent6632bd275454e012ff962800449173b032e959c0 (diff)
downloadgitlab-shell-82b3a4e8f70692ec679d880628fdb0f5844d42b9.tar.gz
Merge branch 'master' into 'master' v2.6.10
Added git gc for housekeeping This merge request will add the gc functionality used by the housekeeping function in the project settings page. see gitlab-org/gitlab-ce#3041 and https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1658 See merge request !23
-rw-r--r--CHANGELOG3
-rw-r--r--README.md4
-rw-r--r--VERSION2
-rw-r--r--lib/gitlab_projects.rb15
4 files changed, 21 insertions, 3 deletions
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/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/VERSION b/VERSION
index d48d370..a04abec 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.6.9
+2.6.10
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