Repository: scala-steward-org/scala-steward (scala)

Issue:
Version.selectNext fails to recognize hashes with a "g" prefix
Here is an update (from 0.0.12 to 0.0.12-3-g699a2cf) that would not have happened if Scala Steward would have recognized the hash in the version: https://github.com/raster-foundry/granary/pull/360

The "g" prefix comes from [git describe](https://git-scm.com/docs/git-describe#_examples):
> The hash suffix is "-g" + unambiguous abbreviation for the tip commit of parent (which was 2414721b194453f058079d897d13c4e377f92dc6). The "g" prefix stands for "git" and is used to allow describing the version of a software depending on the SCM the software is managed with. This is useful in an environment where people may use different SCMs.

Pull request description:
Closes #1561.

Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
index d39012ed07..2e603a107a 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/data/Version.scala
@@ -87,7 +87,7 @@ final case class Version(value: String) {
   }
 
   private[this] def hashIndex: Option[NonNegInt] =
-    """[-+]\p{XDigit}{6,}""".r.findFirstMatchIn(value).flatMap(m => NonNegInt.unapply(m.start))
+    """[-+]g?\p{XDigit}{6,}""".r.findFirstMatchIn(value).flatMap(m => NonNegInt.unapply(m.start))
 
   private val minAlphaOrder: Int =
     alnumComponents.collect { case a: Version.Component.Alpha => a.order }.minOption.getOrElse(0)


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
index 9c955c3c96..fe3fdcf67a 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/data/VersionTest.scala
@@ -196,6 +196,7 @@ class VersionTest
       ("2.2.0", List("2.2.0-0-fe5ed67", "2.2.0-4-4bd225e"), None),
       ("0.116.0-alpha", List("0.118.1-alpha"), None),
       ("0.8.0", List("0.8.0-1-d81662"), None),
+      ("0.0.12", List("0.0.12-3-g699a2cf"), None),
       ("0.6.3", List("289f9e3aa3f5014a5c64319da8e6ab993947ade2-0-289f9e"), None),
       ("0.1-58d9629", List("0.8.0"), Some("0.8.0")),
       ("0.9-a3bf234", List("0.14-9419610"), Some("0.14-9419610")),