Skip to content

Gradle configuration cache broken for spotlessCheck in latest v7.0.2 #2431

Open
@n-hass

Description

@n-hass

the spotlessCheck task seems to (indirectly) use the file .git/HEAD, as switching between branches causes a gradle configuration cache miss.

EG:

> git checkout test-branch
> gradle spotlessCheck
… (stores configuration cache)
> git checkout main
> gradle spotlessCheck
Calculating task graph as configuration cache cannot be reused because file '.git/HEAD' has changed.

spotless is configured as follows in the root level build.gradle.kts

spotless.apply {
  kotlin {
    target("src/**/*.kt”)
    ktlint(libs.versions.ktlint.get())
  }
}

This seems to be caused by JGit. The configuration cache report has the class org.eclipse.jgit.util.io.SilentFileInputStream accessing .git/HEAD and .git/config. Although this is occurinig within JGit, perhaps theres a call to JGit that can be wrapped in a ValueSource? Or perhaps there’s a configuration to change/disable parts of spotless to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions