Reputation: 17
I'm looking for the equivalent command in JGit for
git log --reverse
Can it be done by editing the config file for git.log().all().call()
?
Upvotes: 2
Views: 728
Reputation: 20985
JGit's LogCommand
does not allow to specify the order in which commits are listed.
The underlying RevWalk
, however, can be used directly and allows to change the sort order, for example:
RevWalk walk = new RevWalk( repository );
walk.sort( RevSort.COMMIT_TIME_DESC, true );
walk.sort( RevSort.REVERSE , true );
RevCommit commit = walk.next();
while( commit != null ) {
// use commit
commit = walk.next();
}
walk.close();
Upvotes: 3