Skip to content

Instantly share code, notes, and snippets.

@stefanproell
Created October 1, 2015 12:04
Show Gist options
  • Save stefanproell/34f8ac3fb5b63599976f to your computer and use it in GitHub Desktop.
Save stefanproell/34f8ac3fb5b63599976f to your computer and use it in GitHub Desktop.
Get the most recent commit from a sorted list of commits
/**
* Get the latest commit before a specified date.
* @param execDate
* @param path
* @return
*/
public RevCommit getMostRecentCommit(Date execDate, String path){
TreeMap<DateTime,RevCommit> allCommits = this.getAllCommitsBefore(execDate,path);
RevCommit lastCommit = allCommits.lastEntry().getValue();
return lastCommit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment