I\'m trying to get my hands on the HEAD commit with JGit:
val builder = new FileRepositoryBuilder() val repo = builder.setGitDir(new File(\"/www/test-repo\")
You need to point to the Git metadata directory (probably /www/test-repo/.git) when you call setGitDir, not to the working directory (/www/test-repo).
/www/test-repo/.git
setGitDir
/www/test-repo
I have to admit I'm not sure what findGitDir is supposed to do, but I've run into this problem before and specifying the .git directory worked.
findGitDir
.git