JGit and finding the Head

后端 未结 4 1936
名媛妹妹
名媛妹妹 2021-01-01 10:23

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\")         


        
4条回答
  •  佛祖请我去吃肉
    2021-01-01 11:06

    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).

    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.

提交回复
热议问题