Skip to content

Commit f2bdb8c

Browse files
committed
Fix(RepositoryDeserializer): Fallback to vcsProcessed on blank vcsInfo
Signed-off-by: Jens Keim <[email protected]>
1 parent 8055b98 commit f2bdb8c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

model/src/main/kotlin/Repository.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ private class RepositoryDeserializer : StdDeserializer<Repository>(Repository::c
9191
val parsedProvenance = when {
9292
node.has("vcs") -> {
9393
// Parse [vcs] and [vcsProcessed] attributes
94-
val vcsInfo = jsonMapper.treeToValue<VcsInfo>(node["vcs"])
94+
val vcs = jsonMapper.treeToValue<VcsInfo>(node["vcs"])
9595
val vcsProcess = jsonMapper.treeToValue<VcsInfo>(node["vcs_processed"])
9696

97+
// Fall back to [vcsProcessed], if [vcs] is empty
98+
val vcsInfo = if (vcs != VcsInfo.EMPTY) vcs else vcsProcess
99+
97100
// Get the [vcs]'s revision
98-
val resolvedRevision = if (vcsInfo.revision != "") {
99-
vcsInfo.revision
101+
val resolvedRevision = if (vcs.revision != "") {
102+
vcs.revision
100103
} else if (vcsProcess.revision != "") {
101104
// Fall back to [vcsProcessed], if [vcs] has empty revision
102105
vcsProcess.revision

0 commit comments

Comments
 (0)