Skip to content

Commit

Permalink
Merge pull request #3260 from scala-steward-org/topic/detect-more-hashes
Browse files Browse the repository at this point in the history
Recognize hashes if they are separated with `.` and `_`
  • Loading branch information
fthomas authored Jan 6, 2024
2 parents 5ee9474 + c4cc5ab commit 600d2a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ object Version {
val numeric = Numbers.digits.map(s => List(Numeric(s)))
val alpha = Parser.charsWhile(c => !digits(c) && !separators(c)).map(s => List(Alpha(s)))
val separator = Parser.charIn(separators).map(c => List(Separator(c)))
val hash = (Parser.charIn('-', '+') ~
val hash = (Parser.charIn(separators) ~
Parser.char('g').string.? ~
Rfc5234.hexdig.rep(6).string.filterNot(startsWithDate)).backtrack
.map { case ((s, g), h) => List(Separator(s), Hash(g.getOrElse("") + h)) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class VersionTest extends DisciplineSuite {
("10000000", List("20000000"), Some("20000000")),
("1032048a", List("2032048a4c2"), Some("2032048a4c2")),
("0.1.1-3dfde9d7", List("0.2.1-485fdf3b"), None),
("1.0.0+1319.ae77058", List("1.0.0+1320.38b57aa"), Some("1.0.0+1320.38b57aa")),
("0.1.1", List("0.2.1-485fdf3b"), None),
("0.1.1-ALPHA", List("0.2.1-485fdf3b"), None),
("0.1.1-ALPHA", List("0.2.1-BETA"), None),
Expand Down

0 comments on commit 600d2a3

Please sign in to comment.