Skip to content

ratchetFrom broken when using git worktrees #920

Description

@devinrsmith

A colleague of mine, @nbauernfeind, ran into an issue running ./gradlew spotlessApply. After a bit of debugging, we isolated it to using ratchetFrom in combination with a git worktree. It's a relatively easy issue to workaround (just use a plain git clone instead of worktree); but posting here in case anybody else runs into it until it can be fixed.

Caused by: java.lang.IllegalArgumentException: Cannot find git repository in any parent directory
        at com.diffplug.spotless.extra.GitRatchet.repositoryFor(GitRatchet.java:156)
        at com.diffplug.spotless.extra.GitRatchet.repositoryFor(GitRatchet.java:161)
        at com.diffplug.spotless.extra.GitRatchet.repositoryFor(GitRatchet.java:161)
        at com.diffplug.spotless.extra.GitRatchet.rootTreeShaOf(GitRatchet.java:226)
        at com.diffplug.gradle.spotless.SpotlessTask.setupRatchet(SpotlessTask.java:91)
        at com.diffplug.gradle.spotless.FormatExtension.setupTask(FormatExtension.java:733)
        at com.diffplug.gradle.spotless.JavaExtension.setupTask(JavaExtension.java:164)
        at com.diffplug.gradle.spotless.SpotlessExtensionImpl.lambda$createFormatTasks$6(SpotlessExtensionImpl.java:84)

Version: 5.14.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions