diff --git a/spec/git-version-spec.cr b/spec/git-version-spec.cr index 444e222..bdffbc7 100644 --- a/spec/git-version-spec.cr +++ b/spec/git-version-spec.cr @@ -204,6 +204,41 @@ describe GitVersion do end end + it "identifier can be specified in uppercase" do + tmp = InTmp.new + + begin + git = GitVersion::Git.new("dev", "master", "feature:", "BREAKING CHANGE:", tmp.@tmpdir) + + tmp.exec %(git init) + tmp.exec %(git checkout -b master) + tmp.exec %(git commit --no-gpg-sign --allow-empty -m "1") + tmp.exec %(git tag "1.0.0") + + tmp.exec %(git checkout -b my-fancy.branch) + tmp.exec %(git commit --no-gpg-sign --allow-empty -m "2") + + tmp.exec %(git commit --no-gpg-sign --allow-empty -m "feature: blah + +BREAKING CHANGE: XYZ") + + tmp.exec %(git checkout master) + + version = git.get_new_version + + # no new commit in master, expect no version bump + version.should eq("1.0.0") + + tmp.exec %(git merge my-fancy.branch) + + version = git.get_new_version + + version.should eq("2.0.0") + ensure + tmp.cleanup + end + end + it "correct version on feature after second commit" do tmp = InTmp.new @@ -954,7 +989,6 @@ it "get previous version - first commit" do tmp.exec %(git checkout -b master) tmp.exec %(git commit --no-gpg-sign --allow-empty -m "1") - # git-version should accept the breaking tag on commit with dir2 version = git.get_previous_version version.should eq("0.0.0") diff --git a/src/git-version.cr b/src/git-version.cr index a21e1e7..40ebc8f 100644 --- a/src/git-version.cr +++ b/src/git-version.cr @@ -14,6 +14,9 @@ module GitVersion def initialize(@dev_branch : String, @release_branch : String, @minor_identifier : String, @major_identifier : String, @folder = FileUtils.pwd, @prefix : String = "", @log_paths : String = "", @suffix : String = "", @skip_prerelease : Bool = false) + @major_identifier = @major_identifier.downcase + @minor_identifier = @minor_identifier.downcase + @major_id_is_regex = false @minor_id_is_regex = false if match = /\/(.*)\//.match(@major_identifier)