Skip to content

Commit

Permalink
Merge pull request #77 from armanbilge/fix/mima-ignore-head
Browse files Browse the repository at this point in the history
Make `previousReleases` strictly previous
  • Loading branch information
armanbilge authored Jan 18, 2022
2 parents 53c2f93 + 31b32bb commit aeac2d2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ import scala.sys.process._
object GitHelper {

/**
* Returns a list of strictly previous releases (i.e. ignores tags on HEAD).
* @param fromHead
* if `true`, only tags reachable from HEAD's history. If `false`, all tags in the repo.
*/
def previousReleases(fromHead: Boolean = false): List[V] = {
Try {
val merged = if (fromHead) " --merged" else ""
s"git tag --list$merged".!!.split("\n").toList.map(_.trim).collect {
val merged = if (fromHead) " --merged HEAD" else ""
// --no-contains omits tags on HEAD
s"git tag --no-contains HEAD$merged".!!.split("\n").toList.map(_.trim).collect {
case V.Tag(version) => version
}
}.getOrElse(List.empty).sorted.reverse
Expand Down

0 comments on commit aeac2d2

Please sign in to comment.