diff options
author | Sean Edge <asedge@gmail.com> | 2014-07-09 22:16:52 -0400 |
---|---|---|
committer | Sean Edge <asedge@gmail.com> | 2014-07-09 22:16:52 -0400 |
commit | 5bf1363ea66517561386a6a9b56226ed1fd97a5a (patch) | |
tree | 5a12c47de58f6dac126f75121e9767acf3cd3292 | |
parent | f959bd4d1f80811bb41a9fd6197a44a9ce641157 (diff) | |
download | gitlab-shell-5bf1363ea66517561386a6a9b56226ed1fd97a5a.tar.gz |
Adding support+tests for annotated tags.
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | lib/gitlab_projects.rb | 7 | ||||
-rw-r--r-- | spec/gitlab_projects_spec.rb | 33 |
3 files changed, 34 insertions, 9 deletions
@@ -58,9 +58,10 @@ Remove branch ./bin/gitlab-projects rm-branch gitlab/gitlab-ci.git 3-0-stable -Create tag +Create tag (lightweight & annotated) ./bin/gitlab-projects create-tag gitlab/gitlab-ci.git v3.0.0 3-0-stable + ./bin/gitlab-projects create-tag gitlab/gitlab-ci.git v3.0.0 3-0-stable 'annotated message goes here' Remove tag diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 4067d13..a6fa1b5 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -67,7 +67,12 @@ class GitlabProjects def create_tag tag_name = ARGV.shift ref = ARGV.shift || "HEAD" - cmd = %W(git --git-dir=#{full_path} tag -- #{tag_name} #{ref}) + cmd = %W(git --git-dir=#{full_path} tag) + if ARGV.size > 0 + msg = ARGV.shift + cmd += %W(-a -m #{msg}) + end + cmd += %W(-- #{tag_name} #{ref}) system(*cmd) end diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb index 300029c..44fb879 100644 --- a/spec/gitlab_projects_spec.rb +++ b/spec/gitlab_projects_spec.rb @@ -60,14 +60,33 @@ describe GitlabProjects do let(:gl_projects_create) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') } - let(:gl_projects) { build_gitlab_projects('create-tag', repo_name, 'test_tag', 'master') } + context "lightweight tag" do + let(:gl_projects) { build_gitlab_projects('create-tag', repo_name, 'test_tag', 'master') } - it "should create a tag" do - gl_projects_create.exec - gl_projects.exec - tag_ref = capture_in_tmp_repo(%W(git rev-parse test_tag)) - master_ref = capture_in_tmp_repo(%W(git rev-parse master)) - tag_ref.should == master_ref + it "should create a tag" do + gl_projects_create.exec + gl_projects.exec + tag_ref = capture_in_tmp_repo(%W(git rev-parse test_tag)) + master_ref = capture_in_tmp_repo(%W(git rev-parse master)) + tag_ref.should == master_ref + end + end + context "annotated tag" do + msg = 'some message' + tag_name = 'test_annotated_tag' + let(:gl_projects) { build_gitlab_projects('create-tag', repo_name, tag_name, 'master', msg) } + + it "should create an annotated tag" do + gl_projects_create.exec + gl_projects.exec + + tag_ref = capture_in_tmp_repo(%W(git rev-parse #{tag_name}^{})) + master_ref = capture_in_tmp_repo(%W(git rev-parse master)) + tag_msg = capture_in_tmp_repo(%W(git tag -l -n1 #{tag_name})) + + tag_ref.should == master_ref + tag_msg.should == tag_name + ' ' + msg + end end end |