Skip to content

Commit 9472e68

Browse files
authored
Merge branch 'main' into use-semver-compare
2 parents 81114af + f079e4b commit 9472e68

File tree

7 files changed

+11
-7
lines changed

7 files changed

+11
-7
lines changed

.java-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ You can begin to use git to control your project versions.
7272
The git plugin will now autogenerate your version using the following rules, in order:
7373

7474
1. Looks at version-property setting (default to `project.version`), and checks the `sys.props` to see if this has a value. If so, use it.
75-
2. Otherwise, looks at the project tags. The first to match the `gitTagToVersionNumberSetting` is used to assign the version. The default is to look for tags that begin with `v` and a number, and use the number as the version. If there are multiple version tags, it will pick the highest.
75+
2. Otherwise, looks at the project tags. The first to match the `gitTagToVersionNumber` setting is used to assign the version. The default is to look for tags that begin with `v` and a number, and use the number as the version. If there are multiple version tags, it will pick the highest.
7676
3. If no tags are found either, look at the head commit. We attach this to the `git.baseVersion` setting: "<base-version>.<git commit sha>"
7777
4. If no head commit is present either (which means this is a brand-new repository with no commits yet), we append the current timestamp to the base version: "<base-version>.<timestamp>".
7878

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ enablePlugins(GitVersioning, SbtPlugin)
1414
git.baseVersion := "1.0"
1515

1616
libraryDependencies ++= Seq(
17-
"org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.1.202206130422-r",
17+
"org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.3.202401111512-r",
1818
"com.github.zafarkhaja" % "java-semver" % "0.10.2",
19-
"org.scalameta" %% "munit" % "0.7.29" % Test
19+
"org.scalameta" %% "munit" % "1.0.1" % Test,
2020
)
2121

2222
scriptedLaunchOpts += s"-Dproject.version=${version.value}"

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.7.0
1+
sbt.version=1.10.0

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
22

3-
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
3+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.6.1")

src/main/scala/com/github/sbt/git/ConsoleGitReadableOnly.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ class ConsoleGitReadableOnly(git: GitRunner, cwd: File, log: Logger) extends Git
1515

1616
def describedVersion: Option[String] = Try(git("describe", "--tags")(cwd, log).split("\\s+").headOption).toOption.flatten
1717

18+
override def describedVersion(patterns: Seq[String]): Option[String] =
19+
patterns.headOption.fold(describedVersion)(pat =>
20+
Try(git("describe", "--tags", "--match", pat)(cwd, log).split("\\s+").headOption).toOption.flatten
21+
)
22+
1823
def hasUncommittedChanges: Boolean = Try(!git("status", "-s")(cwd, log).trim.isEmpty).getOrElse(true)
1924

2025
def branches: Seq[String] = Try(git("branch", "--list")(cwd, log).split("\\s+").toSeq).getOrElse(Seq())

src/main/scala/com/github/sbt/git/GitPlugin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ object SbtGit {
176176
* Versioning runs through the following:
177177
*
178178
* 1. Looks at version-property settings, and checks the sys.props to see if this has a value.
179-
* 2. Looks at the project tags. The first to match the `gitTagToVersionNumberSetting` is used to assign the version.
179+
* 2. Looks at the project tags. The first to match the `gitTagToVersionNumber` setting is used to assign the version.
180180
* 3. if we have a head commit, we attach this to the base version setting "<base-version>.<git commit sha>"
181181
* 4. We append the current timestamp to the base version: "<base-version>.<timestamp>"
182182
*/

0 commit comments

Comments
 (0)