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

Issue:
Dependencies with hash no longer updated
Some of our libraries are not being updated anymore starting version 0.7.0 and up. The last working version seems to be 0.6.0.

We have a hash in our release versions. Template: `x.y.z-yyyyMMdd-HHmmss-<git hash>`

example: 
`1.0.0-20201119-091040-d8b7496c`

Pull request description:
With this tweak Scala Steward updates versions with dates and hashes
again.

Closes #1790.

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 1df2cb06d6..32d8266de9 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
@@ -85,8 +85,13 @@ final case class Version(value: String) {
       .find(m => !Version.startsWithDate(m.matched.drop(1)))
       .flatMap(m => NonNegInt.unapply(m.start))
 
+  private val alnumComponentsWithoutHash: List[Version.Component] =
+    hashIndex
+      .map(i => alnumComponents.takeWhile(_.startIndex < i.value))
+      .getOrElse(alnumComponents)
+
   private[this] val preReleaseIndex: Option[NonNegInt] = {
-    val preReleaseIdentIndex = alnumComponents.collectFirst {
+    val preReleaseIdentIndex = alnumComponentsWithoutHash.collectFirst {
       case a: Version.Component.Alpha if a.isPreReleaseIdent => NonNegInt.unsafeFrom(a.startIndex)
     }
     preReleaseIdentIndex.orElse(hashIndex)
@@ -97,11 +102,6 @@ final case class Version(value: String) {
       .map(i => alnumComponents.takeWhile(_.startIndex < i.value))
       .getOrElse(alnumComponents)
 
-  private val alnumComponentsWithoutHash: List[Version.Component] =
-    hashIndex
-      .map(i => alnumComponents.takeWhile(_.startIndex < i.value))
-      .getOrElse(alnumComponents)
-
   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 539cee10a5..33ef432a28 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
@@ -208,6 +208,11 @@ class VersionTest
       ("v2-rev374-1.23.0", List("v2-rev20190917-1.30.3"), Some("v2-rev20190917-1.30.3")),
       ("1.0.0-20201119", List("1.0.0-20201208"), Some("1.0.0-20201208")),
       ("1.0.0-20201119-091040", List("1.0.0-20201208-143052"), Some("1.0.0-20201208-143052")),
+      (
+        "1.0.0-20201119-091040-d8b7496c",
+        List("1.0.0-20201208-143052-2c1b1172"),
+        Some("1.0.0-20201208-143052-2c1b1172")
+      ),
       ("0.27.0-RC1", List("0.27.0-bin-20200826-2e58a66-NIGHTLY"), None)
     )