Skip to content

Commit 85785df

Browse files
committed
fix: If adding a fix to a pre-release without a number, bump patch version instead of ignoring the fix.
1 parent 0d35aa0 commit 85785df

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/kotlin/git/semver/plugin/semver/MutableSemVersion.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ internal class MutableSemVersion(
141141
}
142142

143143
settings.patchRegex.containsMatchIn(text) ->
144-
if (!isPreRelease) {
144+
if (preRelease.number == null) {
145145
bumpPatch += 1
146146
bumpPre = 0
147-
} else if (preRelease.number != null) {
147+
} else {
148148
bumpPre += 1
149149
}
150150
}

src/test/kotlin/git/semver/plugin/scm/GitProviderTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class GitProviderTest {
233233
commit(it, "fix: update semver plugin", gitProvider)
234234
val actual = release(gitProvider, it, "-")
235235

236-
assertEquals("0.0.2", actual.toVersionString())
236+
assertEquals("0.0.3", actual.toVersionString())
237237
}
238238
printFoot()
239239
}
@@ -254,7 +254,7 @@ class GitProviderTest {
254254
commit(it, "fix: update semver plugin", gitProvider)
255255
val actual = release(gitProvider, it, "-")
256256

257-
assertEquals("0.0.2", actual.toVersionString())
257+
assertEquals("0.0.3", actual.toVersionString())
258258
}
259259
printFoot()
260260
}

0 commit comments

Comments
 (0)