JGit and finding the Head

后端 未结 4 1923
名媛妹妹
名媛妹妹 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 10:57

    You can also use val git: Git = Git.open( new File( "/www/test-repo" ) ). JGit will then scan the given folder for the git meta directory (usually .git). If it fails to find this folder, an IOException will be thrown.

提交回复
热议问题