summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-28 09:33:27 +0000
committerRémy Coutable <remy@rymai.me>2016-04-28 09:33:27 +0000
commit3f942ef589a4b9bc1d9ed7fd0aaf9e186be57935 (patch)
tree93ac7f23e2b0fe1ca69863e988509acd2630a784
parentc73b6a1c593f7bbab4b09d5cf882de78f54d6f09 (diff)
parent6bf9a57c97d22adb858dd0e7464e6f8e1a896593 (diff)
downloadgitlab-shell-3f942ef589a4b9bc1d9ed7fd0aaf9e186be57935.tar.gz
Merge branch 'revert-53' into 'master'
Revert "Remove unused #list_remote_tags" This reverts commit f5e87590d463b4b3d1bf5cd6b49a9d0d60acd552 because `#list_remote_tags` is still used by EE:https://gitlab.com/gitlab-org/gitlab-ee/blob/2c364a79ee110a3adf49d6bd30be985ed13c3ec5/lib/gitlab/backend/shell.rb#L45. /cc @razer6 See merge request !56
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab_projects.rb22
2 files changed, 22 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index ee12d2a..a86ac09 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,4 @@
v3.0.0
- - Remove list-remote-tags command (Robert Schilling)
- Remove rm-tag command (Robert Schilling)
- Remove create-branch and rm-branch commands (Robert Schilling)
- Update PostReceive worker so it logs a unique JID in Sidekiq
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index bc98e09..f0e0773 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -61,6 +61,7 @@ class GitlabProjects
when 'update-head'; update_head
when 'push-branches'; push_branches
when 'delete-remote-branches'; delete_remote_branches
+ when 'list-remote-tags'; list_remote_tags
when 'gc'; gc
else
$logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}."
@@ -71,6 +72,27 @@ class GitlabProjects
protected
+ def list_remote_tags
+ remote_name = ARGV.shift
+
+ tag_list, exit_code, error = nil
+ cmd = %W(git --git-dir=#{full_path} ls-remote --tags #{remote_name})
+
+ Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thr|
+ tag_list = stdout.read
+ error = stderr.read
+ exit_code = wait_thr.value.exitstatus
+ end
+
+ if exit_code.zero?
+ puts tag_list
+ true
+ else
+ puts error
+ false
+ end
+ end
+
def push_branches
remote_name = ARGV.shift