Commit 5bf1363e authored by Sean Edge's avatar Sean Edge

Adding support+tests for annotated tags.

parent f959bd4d
......@@ -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
......
......@@ -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
......
......@@ -60,6 +60,7 @@ describe GitlabProjects do
let(:gl_projects_create) {
build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git')
}
context "lightweight tag" do
let(:gl_projects) { build_gitlab_projects('create-tag', repo_name, 'test_tag', 'master') }
it "should create a tag" do
......@@ -70,6 +71,24 @@ describe GitlabProjects do
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
describe :rm_tag do
let(:gl_projects_create) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment