Skip to content

Commit

Permalink
fix(Provenance): Fix matches method
Browse files Browse the repository at this point in the history
  • Loading branch information
pepper-jk committed Jun 20, 2024
1 parent 2acda4d commit d477132
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion model/src/main/kotlin/Provenance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ data class RepositoryProvenance(
* Return true if this provenance matches the processed VCS information of the [package][pkg].
*/
override fun matches(pkg: Package): Boolean = vcsInfo == pkg.vcsProcessed
override fun matches(other: KnownProvenance): Boolean = other is RepositoryProvenance && vcsInfo == other.vcsInfo

/**
* Return true if this provenance matches the [knownProvenance][other].
*/
override fun matches(other: KnownProvenance): Boolean =
other is RepositoryProvenance && other.vcsInfo.normalize().matches(vcsInfo.normalize())
}

/**
Expand Down
5 changes: 5 additions & 0 deletions model/src/main/kotlin/VcsInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ data class VcsInfo(
* Return a [VcsInfoCurationData] with the properties from this [VcsInfo].
*/
fun toCuration() = VcsInfoCurationData(type, url, revision, path)

/**
* Return true if this vcs information matches the other vcs information.
*/
fun matches(other: VcsInfo) = type == other.type && url == other.url && revision == other.revision
}

/**
Expand Down

0 comments on commit d477132

Please sign in to comment.