I am experimenting with JGit for a project, and although it works mostly, getting the oldest (first) commit does not. Here is the code:
RevWalk rw = new RevWalk(new Repository( new File("/path/to/git"))); RevCommit oldest; Iterator<RevCommit> i = rw.iterator(); if (i.hasNext()) oldest = i.next(); Commit c = oldest.asCommit(rw); //oldest is null here, NPE
Does anyone know what I'm doing wrong?
java git
Georgios gousios
source share