java - Retrieving oldest commit with JGit -


I am experimenting with a JGIT for a project and when it mostly works, the oldest (first) Retrieving Commitment Here's the code:

  RevWalk rw = new RevWalk (new file ("/ path / to / git")); RevCommit Oldest; Iterator & LT; RevCommit & gt; I = RW Knitter (); If (i.hasNext ()) is the oldest = i.next (); Committee C = Old. Comment (RW); // The oldest is here, NPE  

Do anyone know what I'm doing?

I think I found it. You must log in to log in and have to set a starting point to start it through revision. The following conclusions that I wanted, but I somehow doubt how best it is.

  RevWalk rw = new RevWalk (new repository (new file ("/ path / to / GIT")); RevCommit C = Faucet; AnyObjectId headId; Try {HeadId = git.resolve (Constants.HEAD); RevCommit root = rw.parseCommit (headId); Rw.sort (RevSort.REVERSE); Rw.markStart (root); C = rw.next (); } Hold (IOException e) {e.printStackTrace (); }  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -