Skip to content

Commit c45f7ba

Browse files
committed
fix(Analyzer): Populate resolvedRevision with Worktree.getRevision()
Signed-off-by: Jens Keim <[email protected]>
1 parent dc3e808 commit c45f7ba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

analyzer/src/main/kotlin/Analyzer.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,19 @@ class Analyzer(private val config: AnalyzerConfiguration, private val labels: Ma
145145

146146
val workingTree = VersionControlSystem.forDirectory(info.absoluteProjectPath)
147147
val vcs = workingTree?.getInfo().orEmpty()
148+
val resolvedRevision = workingTree?.getRevision().orEmpty()
148149
val nestedVcs = workingTree?.getNested()?.filter { (path, _) ->
149150
// Only include nested VCS if they are part of the analyzed directory.
150151
workingTree.getRootPath().resolve(path).startsWith(info.absoluteProjectPath)
151152
}.orEmpty()
152153

153-
val repository = if (vcs == VcsInfo.EMPTY) {
154+
val repository = if (vcs == VcsInfo.EMPTY || resolvedRevision.isEmpty()) {
154155
Repository.EMPTY
155156
} else {
156157
Repository(
157158
provenance = RepositoryProvenance(
158159
vcsInfo = vcs.normalize(),
159-
resolvedRevision = vcs.revision
160+
resolvedRevision = resolvedRevision
160161
),
161162
nestedRepositories = nestedVcs,
162163
config = info.repositoryConfiguration

0 commit comments

Comments
 (0)