I can reproduce the NPE with a single line:
Â RepositoryCache.FileKey.isGitRepository(new File("repo.git"), FS.DETECTED)
if the relative path "repo.git" doesn't exist yet.
It's a regression, the previous (File-based, not Path-based) JGit versions
worked fine in this situation.
The problem happens because
Â new File("repo.git").toPath().getParent()
evaluates to null in
(The corresponding line is:Â Path dir = Files.isDirectory(file) ? file :
The documentation doesn't mention whether the path can or cannot be
So I wonder whether this is expected behaviour, and I should use the
absolute path or is it a bug in JGit and it should work with relative paths
I added a test with your example but it doesn't fail on Mac:
Can you try that in your environment?