-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent failure on sbt init when JGit finds a .git with no commit
2ca68e4 exposed failure to lookup commits during sbt initialization, while it would only happen on `scalafix` invocation earlier.
- Loading branch information
1 parent
0e65416
commit c3a7c50
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/test/scala/scalafix/internal/sbt/JGitCompletionsSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package scalafix.internal.sbt | ||
|
||
import org.scalatest.funsuite.AnyFunSuite | ||
|
||
class JGitCompletionsSuite extends AnyFunSuite { | ||
|
||
test("directory with no .git") { | ||
val fs = new Fs() | ||
val jgit = new JGitCompletion(fs.workingDirectory) | ||
assert(jgit.last20Commits == Nil) | ||
} | ||
|
||
test("directory with empty .git") { | ||
val fs = new Fs() | ||
fs.mkdir(".git") | ||
val jgit = new JGitCompletion(fs.workingDirectory) | ||
assert(jgit.last20Commits == Nil) | ||
} | ||
|
||
test("directory with no commits") { | ||
val fs = new Fs() | ||
new Git(fs.workingDirectory) // git init | ||
val jgit = new JGitCompletion(fs.workingDirectory) | ||
assert(jgit.last20Commits == Nil) | ||
} | ||
|
||
} |