@@ -595,43 +595,42 @@ public List<VCSCommit> getCommitsRange(String branchName, String startFromCommit
595595 int limit ) {
596596 try (IVCSLockedWorkingCopy wc = repo .getVCSLockedWorkingCopy ();
597597 Git git = getLocalGit (wc );
598- Repository gitRepo = git .getRepository ()) {
598+ Repository gitRepo = git .getRepository ();
599+ RevWalk rw = new RevWalk (gitRepo )) {
599600
600601 checkout (git , gitRepo , branchName , null );
601602
602603 String bn = getRealBranchName (branchName );
603604
604605 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+ }
623623
624- rw .markStart (startCommit );
624+ rw .markStart (startCommit );
625625
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 ;
634632 }
633+ commit = rw .next ();
635634 }
636635
637636 if (direction == WalkDirection .ASC ) {
0 commit comments