Skip to content

Commit

Permalink
Fixed JGit usage in gradle (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
nulls committed Apr 24, 2023
1 parent ce972e2 commit 77ae870
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.ajoberstar.reckon.gradle.ReckonExtension
import org.ajoberstar.reckon.gradle.ReckonPlugin
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.internal.storage.file.FileRepository
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
Expand Down Expand Up @@ -47,7 +48,11 @@ fun Project.configureVersioning() {
}

private fun Project.failOnUncleanTree() {
val status = Git(FileRepository(project.rootDir))
val status = FileRepositoryBuilder()
.findGitDir(project.rootDir)
.setup()
.let(::FileRepository)
.let(::Git)
.status()
.call()
if (!status.isClean) {
Expand Down

0 comments on commit 77ae870

Please sign in to comment.