Skip to content

Commit a799cee

Browse files
committed
fix(ScannerIntegrationFunTest): Fallback on emptyValue if revision blank
Signed-off-by: Jens Keim <[email protected]>
1 parent 7947a77 commit a799cee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scanner/src/funTest/kotlin/scanners/ScannerIntegrationFunTest.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import java.io.File
2828
import org.ossreviewtoolkit.downloader.DefaultWorkingTreeCache
2929
import org.ossreviewtoolkit.model.AnalyzerResult
3030
import org.ossreviewtoolkit.model.AnalyzerRun
31+
import org.ossreviewtoolkit.model.HashAlgorithm
3132
import org.ossreviewtoolkit.model.Identifier
3233
import org.ossreviewtoolkit.model.LicenseFinding
3334
import org.ossreviewtoolkit.model.OrtResult
@@ -165,12 +166,18 @@ private fun createAnalyzerResultWithProject(project: Project, vararg packages: P
165166
config = AnalyzerConfiguration(enabledPackageManagers = emptyList())
166167
)
167168

169+
val resolvedRevision = if (projectWithScope.vcs.revision == "") {
170+
HashAlgorithm.SHA1.emptyValue
171+
} else {
172+
projectWithScope.vcs.revision
173+
}
174+
168175
return OrtResult.EMPTY.copy(
169176
analyzer = analyzerRun,
170177
repository = Repository.EMPTY.copy(
171178
provenance = RepositoryProvenance(
172179
vcsInfo = projectWithScope.vcs,
173-
resolvedRevision = projectWithScope.vcs.revision
180+
resolvedRevision = resolvedRevision
174181
)
175182
)
176183
)

0 commit comments

Comments
 (0)