Skip to content

Commit 0a24493

Browse files
Merge pull request #108 from codacy/ls/change-regex-expression
fix: only consider major when commit message starts with `breaking:`
2 parents 995fc07 + 637c585 commit 0a24493

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
CRYSTAL?=$(shell which crystal)
22
CRYSTAL_FLAGS=--release
33
CRYSTAL_STATIC_FLAGS=--static
4-
54
VERSION?=$(shell cat .version)
65

76
all: fmt test build docker_build ## clean and produce target binary and docker image

spec/git-version-spec.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ describe GitVersion do
474474
tmp.exec %(git checkout -b master)
475475
tmp.exec %(git commit --no-gpg-sign --allow-empty -m "1")
476476
tmp.exec %(git tag "0.1.0")
477-
tmp.exec %(git commit --no-gpg-sign --allow-empty -m ":breaking: 2")
477+
tmp.exec %(git commit --no-gpg-sign --allow-empty -m "breaking: 2")
478478

479479
version = git.get_new_version
480480
version.should eq("1.0.0")
@@ -495,7 +495,7 @@ describe GitVersion do
495495
tmp.exec %(git tag "0.1.0")
496496
tmp.exec %(git commit --no-gpg-sign --allow-empty -m "feature: 2")
497497
tmp.exec %(git tag "0.2.0-asd")
498-
tmp.exec %(git commit --no-gpg-sign --allow-empty -m ":breaking: 2")
498+
tmp.exec %(git commit --no-gpg-sign --allow-empty -m "breaking: 2")
499499

500500
version = git.get_new_version
501501
version.should eq("1.0.0")

src/git-version.cr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,7 @@ module GitVersion
152152
major = false
153153
get_commits_since(previous_tag).each do |c|
154154
commit = c.downcase
155-
match = if @major_id_is_regex
156-
/#{@major_identifier}/.match(commit)
157-
else
158-
commit.includes?(@major_identifier)
159-
end
155+
match = /^#{@major_identifier}/.match(commit)
160156
if match
161157
previous_version =
162158
SemanticVersion.new(

0 commit comments

Comments
 (0)