@@ -595,43 +595,42 @@ public List<VCSCommit> getCommitsRange(String branchName, String startFromCommit
595
595
int limit ) {
596
596
try (IVCSLockedWorkingCopy wc = repo .getVCSLockedWorkingCopy ();
597
597
Git git = getLocalGit (wc );
598
- Repository gitRepo = git .getRepository ()) {
598
+ Repository gitRepo = git .getRepository ();
599
+ RevWalk rw = new RevWalk (gitRepo )) {
599
600
600
601
checkout (git , gitRepo , branchName , null );
601
602
602
603
String bn = getRealBranchName (branchName );
603
604
604
605
List <VCSCommit > res = new ArrayList <>();
605
- try (RevWalk rw = new RevWalk (gitRepo )) {
606
- RevCommit startCommit ;
607
- RevCommit endCommit ;
608
- if (direction == WalkDirection .ASC ) {
609
- Ref ref = gitRepo .exactRef ("refs/heads/" + bn );
610
- ObjectId headCommitId = ref .getObjectId ();
611
- startCommit = rw .parseCommit ( headCommitId );
612
- ObjectId sinceCommit = startFromCommitId == null ?
613
- getInitialCommit (gitRepo , bn ).getId () :
614
- ObjectId .fromString (startFromCommitId );
615
- endCommit = rw .parseCommit (sinceCommit );
616
- } else {
617
- ObjectId sinceCommit = startFromCommitId == null ?
618
- gitRepo .exactRef ("refs/heads/" + bn ).getObjectId () :
619
- ObjectId .fromString (startFromCommitId );
620
- startCommit = rw .parseCommit ( sinceCommit );
621
- endCommit = getInitialCommit (gitRepo , bn );
622
- }
606
+ RevCommit startCommit ;
607
+ RevCommit endCommit ;
608
+ if (direction == WalkDirection .ASC ) {
609
+ Ref ref = gitRepo .exactRef ("refs/heads/" + bn );
610
+ ObjectId headCommitId = ref .getObjectId ();
611
+ startCommit = rw .parseCommit ( headCommitId );
612
+ ObjectId sinceCommit = startFromCommitId == null ?
613
+ getInitialCommit (gitRepo , bn ).getId () :
614
+ ObjectId .fromString (startFromCommitId );
615
+ endCommit = rw .parseCommit (sinceCommit );
616
+ } else {
617
+ ObjectId sinceCommit = startFromCommitId == null ?
618
+ gitRepo .exactRef ("refs/heads/" + bn ).getObjectId () :
619
+ ObjectId .fromString (startFromCommitId );
620
+ startCommit = rw .parseCommit ( sinceCommit );
621
+ endCommit = getInitialCommit (gitRepo , bn );
622
+ }
623
623
624
- rw .markStart (startCommit );
624
+ rw .markStart (startCommit );
625
625
626
- RevCommit commit = rw .next ();
627
- while (commit != null ) {
628
- VCSCommit vcsCommit = getVCSCommit (commit );
629
- res .add (vcsCommit );
630
- if (commit .getName ().equals (endCommit .getName ())) {
631
- break ;
632
- }
633
- commit = rw .next ();
626
+ RevCommit commit = rw .next ();
627
+ while (commit != null ) {
628
+ VCSCommit vcsCommit = getVCSCommit (commit );
629
+ res .add (vcsCommit );
630
+ if (commit .getName ().equals (endCommit .getName ())) {
631
+ break ;
634
632
}
633
+ commit = rw .next ();
635
634
}
636
635
637
636
if (direction == WalkDirection .ASC ) {
0 commit comments