@@ -156,6 +156,128 @@ public void SupportBranches()
156
156
fixture . AssertFullSemver ( "1.0.5-PullRequest0007.3" , config ) ;
157
157
}
158
158
159
+ [ Test ]
160
+ public void HotfixBranchesWithTaggedCommitsOnMain ( )
161
+ {
162
+ using var fixture = new EmptyRepositoryFixture ( ) ;
163
+ var configBumpMinor = new Config ( )
164
+ {
165
+ VersioningMode = VersioningMode . Mainline ,
166
+ Increment = IncrementStrategy . Minor ,
167
+ Branches =
168
+ {
169
+ {
170
+ Config . MainBranchKey ,
171
+ new BranchConfig
172
+ {
173
+ Regex = Config . MainBranchRegex ,
174
+ SourceBranches = new HashSet < string >
175
+ {
176
+ Config . DevelopBranchKey ,
177
+ Config . ReleaseBranchKey
178
+ } ,
179
+ Tag = string . Empty ,
180
+ PreventIncrementOfMergedBranchVersion = true ,
181
+ Increment = IncrementStrategy . Minor ,
182
+ IsMainline = true ,
183
+ PreReleaseWeight = 55000 ,
184
+ }
185
+ } ,
186
+ {
187
+ Config . HotfixBranchKey ,
188
+ new BranchConfig
189
+ {
190
+ Tag = ""
191
+ }
192
+ }
193
+ }
194
+ } ;
195
+
196
+ fixture . Repository . MakeACommit ( "1" ) ;
197
+ fixture . MakeATaggedCommit ( "1.0.0" ) ;
198
+
199
+ fixture . MakeACommit ( ) ; // 1.1.0
200
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
201
+ fixture . ApplyTag ( "1.1.0" ) ;
202
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
203
+
204
+ fixture . BranchTo ( "hotfix/may" ) ;
205
+ fixture . AssertFullSemver ( "1.1.1" , configBumpMinor ) ;
206
+
207
+ // Move main on
208
+ fixture . Checkout ( MainBranch ) ;
209
+ fixture . MakeACommit ( ) ;
210
+ fixture . AssertFullSemver ( "1.2.0" , configBumpMinor ) ;
211
+
212
+ // Continue on hotfix
213
+ fixture . Checkout ( "hotfix/may" ) ;
214
+ fixture . MakeACommit ( ) ; // 1.2.1
215
+ fixture . AssertFullSemver ( "1.1.1" , configBumpMinor ) ;
216
+ }
217
+
218
+ [ Test ]
219
+ public void HotfixBranchesWithTaggedCommitsOnHotfix ( )
220
+ {
221
+ using var fixture = new EmptyRepositoryFixture ( ) ;
222
+ var configBumpMinor = new Config ( )
223
+ {
224
+ VersioningMode = VersioningMode . Mainline ,
225
+ Increment = IncrementStrategy . Minor ,
226
+ Branches =
227
+ {
228
+ {
229
+ Config . MainBranchKey ,
230
+ new BranchConfig
231
+ {
232
+ Regex = Config . MainBranchRegex ,
233
+ SourceBranches = new HashSet < string >
234
+ {
235
+ Config . DevelopBranchKey ,
236
+ Config . ReleaseBranchKey
237
+ } ,
238
+ Tag = string . Empty ,
239
+ PreventIncrementOfMergedBranchVersion = true ,
240
+ Increment = IncrementStrategy . Minor ,
241
+ IsMainline = true ,
242
+ PreReleaseWeight = 55000 ,
243
+ }
244
+ } ,
245
+ {
246
+ Config . HotfixBranchKey ,
247
+ new BranchConfig
248
+ {
249
+ Tag = ""
250
+ }
251
+ }
252
+ }
253
+ } ;
254
+
255
+ fixture . Repository . MakeACommit ( "1" ) ;
256
+ fixture . MakeATaggedCommit ( "1.0.0" ) ;
257
+
258
+ fixture . MakeACommit ( ) ; // 1.1.0
259
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
260
+ fixture . ApplyTag ( "1.1.0" ) ;
261
+ fixture . AssertFullSemver ( "1.1.0" , configBumpMinor ) ;
262
+ fixture . MakeACommit ( ) ; // 1.2.0
263
+ fixture . AssertFullSemver ( "1.2.0" , configBumpMinor ) ;
264
+
265
+ fixture . BranchTo ( "hotfix/may" ) ;
266
+ fixture . AssertFullSemver ( "1.2.1" , configBumpMinor ) ;
267
+
268
+ // Move main on
269
+ fixture . Checkout ( MainBranch ) ;
270
+ fixture . MakeACommit ( ) ;
271
+ fixture . AssertFullSemver ( "1.3.0" , configBumpMinor ) ;
272
+
273
+ // Continue on hotfix
274
+ fixture . Checkout ( "hotfix/may" ) ;
275
+ fixture . MakeACommit ( ) ; // 1.2.1
276
+ fixture . MakeATaggedCommit ( "1.2.2" ) ;
277
+ fixture . MakeACommit ( ) ; // 1.2.3
278
+ fixture . AssertFullSemver ( "1.2.3" , configBumpMinor ) ;
279
+ }
280
+
159
281
[ Test ]
160
282
public void VerifyForwardMerge ( )
161
283
{
0 commit comments