Skip to content

Commit a4f233b

Browse files
committed
build: support git worktrees in sbt-git
The JGit bundled with sbt-git 2.1.0 (5.13.x) cannot read linked git worktrees (where .git is a file containing 'gitdir: ...') and aborts project load with NoWorkTreeException. When the build is loaded from a linked worktree, enable useReadableConsoleGit so sbt-git shells out to the git CLI for read-only operations instead. See sbt/sbt-git#264.
1 parent 580fbf5 commit a4f233b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

build.sbt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ lazy val V =
2121
val kctfork = "0.7.1"
2222
}
2323

24+
// sbt-git's bundled JGit can't read linked worktrees; shell out to
25+
// git CLI there. See https://github.com/sbt/sbt-git/issues/264.
26+
if (file(".git").isFile)
27+
Seq(useReadableConsoleGit)
28+
else
29+
Nil
30+
2431
inThisBuild(
2532
List(
2633
scalaVersion := V.scala213,

0 commit comments

Comments
 (0)