Skip to content
Snippets Groups Projects
Commit b9bbbb31 authored by Valery Sizov's avatar Valery Sizov
Browse files

Fix 'ci skip' tag

parent 5f4de8f9
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -58,10 +58,6 @@ class Commit < ActiveRecord::Base
project.gitlab?
end
 
def ci_skip?
!!(git_commit_message =~ /(\[ci skip\])/)
end
def git_author_name
commit_data[:author][:name] if commit_data && commit_data[:author]
end
Loading
Loading
Loading
Loading
@@ -15,6 +15,10 @@ class CreateCommitService
return false
end
 
if params[:commits] && params[:commits].last[:message] =~ /(\[ci skip\])/
return false
end
if origin_ref.start_with?('refs/tags/') && !project.create_commit_for_tag?(ref)
return false
end
Loading
Loading
Loading
Loading
@@ -54,20 +54,6 @@ describe Commit do
end
end
 
describe :ci_skip? do
let(:project) { FactoryGirl.create(:project) }
let(:commit) { FactoryGirl.create(:commit, project: project) }
it 'true if commit message contains [ci skip]' do
commit.stub(:git_commit_message) { 'Small typo [ci skip]' }
commit.ci_skip?.should == true
end
it 'false if commit message does not contain [ci skip]' do
commit.ci_skip?.should == false
end
end
describe :project_recipients do
 
context 'always sending notification' do
Loading
Loading
Loading
Loading
@@ -73,5 +73,22 @@ describe CreateCommitService do
result.should be_persisted
end
end
describe :ci_skip? do
it "skips commit creation if there is [ci skip] tag in commit message" do
commits = [{message: "some message[ci skip]"}]
result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312', commits: commits)
result.should be_false
end
it "does not skips commit creation if there is no [ci skip] tag in commit message" do
project.jobs.first.update(build_tags: true)
commits = [{message: "some message"}]
result = service.execute(project, ref: 'refs/tags/0_1', before: '00000000', after: '31das312', commits: commits)
result.should be_persisted
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment