@@ -12,7 +12,8 @@ module GitVersion
12
12
13
13
class Git
14
14
def initialize (@dev_branch : String , @release_branch : String , @minor_identifier : String , @major_identifier : String ,
15
- @folder = FileUtils .pwd, @prefix : String = " " , @log_paths : String = " " )
15
+ @folder = FileUtils .pwd, @prefix : String = " " , @log_paths : String = " " ,
16
+ @skip_prerelease : Bool = false )
16
17
@major_id_is_regex = false
17
18
@minor_id_is_regex = false
18
19
if match = /\/ (.*) \/ / .match(@major_identifier )
@@ -187,31 +188,33 @@ module GitVersion
187
188
end
188
189
end
189
190
190
- cb = current_branch_or_tag
191
+ if ! @skip_prerelease
192
+ cb = current_branch_or_tag
191
193
192
- if cb == @release_branch
193
- #
194
- elsif cb == @dev_branch
195
- prerelease = [DEV_BRANCH_SUFFIX , commits_distance(previous_tag), current_commit_hash()] of String | Int32
196
- previous_version =
197
- SemanticVersion .new(
198
- previous_version.major,
199
- previous_version.minor,
200
- previous_version.patch,
201
- SemanticVersion ::Prerelease .new(prerelease),
202
- nil
203
- )
204
- else
205
- branch_sanitized_name = cb.downcase.gsub(/[^a-zA-Z0-9] / , " " )[0 ,30 ]
206
- prerelease = [branch_sanitized_name, commits_distance(previous_tag), current_commit_hash()] of String | Int32
207
- previous_version =
208
- SemanticVersion .new(
209
- previous_version.major,
210
- previous_version.minor,
211
- previous_version.patch,
212
- SemanticVersion ::Prerelease .new(prerelease),
213
- nil
214
- )
194
+ if cb == @release_branch
195
+ #
196
+ elsif cb == @dev_branch
197
+ prerelease = [DEV_BRANCH_SUFFIX , commits_distance(previous_tag), current_commit_hash()] of String | Int32
198
+ previous_version =
199
+ SemanticVersion .new(
200
+ previous_version.major,
201
+ previous_version.minor,
202
+ previous_version.patch,
203
+ SemanticVersion ::Prerelease .new(prerelease),
204
+ nil
205
+ )
206
+ else
207
+ branch_sanitized_name = cb.downcase.gsub(/[^a-zA-Z0-9] / , " " )[0 ,30 ]
208
+ prerelease = [branch_sanitized_name, commits_distance(previous_tag), current_commit_hash()] of String | Int32
209
+ previous_version =
210
+ SemanticVersion .new(
211
+ previous_version.major,
212
+ previous_version.minor,
213
+ previous_version.patch,
214
+ SemanticVersion ::Prerelease .new(prerelease),
215
+ nil
216
+ )
217
+ end
215
218
end
216
219
217
220
return add_prefix(previous_version.to_s)
0 commit comments