99import java .util .Collections ;
1010import java .util .Comparator ;
1111import java .util .HashSet ;
12+ import java .util .Iterator ;
1213import java .util .List ;
1314import java .util .Set ;
1415
@@ -451,7 +452,7 @@ public List<VCSDiffEntry> getBranchesDiff(final String srcBranchName, final Stri
451452 @ Override
452453 public Set <String > getBranches (String path ) {
453454 try {
454- List <String > entries = listEntries (SVNVCS .BRANCHES_PATH , path == null ? "" : path );
455+ List <String > entries = listEntries (SVNVCS .BRANCHES_PATH + ( path == null ? "" : path ) );
455456 Set <String > tempRes = new HashSet <>(entries );
456457 if (repository .checkPath (MASTER_PATH , -1 ) == SVNNodeKind .DIR ) {
457458 if (path == null || MASTER_PATH .startsWith (path ) ) {
@@ -470,15 +471,15 @@ public Set<String> getBranches(String path) {
470471 }
471472 }
472473
473- protected List <String > listEntries (String path , String subdirStartsWith ) throws Exception {
474+ protected List <String > listEntries (String path ) throws Exception {
474475 List <String > res = new ArrayList <>();
475- if (repository .checkPath (path , -1 ) == SVNNodeKind .NONE ) {
476+ if (repository .checkPath (path , -1 ) == SVNNodeKind .NONE ) {
476477 return res ;
477478 }
478479 @ SuppressWarnings ("unchecked" )
479- Collection <SVNDirEntry > subEntries = repository .getDir (path , -1 , null , (Collection <SVNDirEntry >) null );
480- List <SVNDirEntry > list = new ArrayList <>(subEntries );
481- Collections .sort (list , new Comparator <SVNDirEntry >() {
480+ Collection <SVNDirEntry > entries = repository .getDir (path , -1 , null , (Collection <SVNDirEntry >) null );
481+ List <SVNDirEntry > entriesList = new ArrayList <>(entries );
482+ Collections .sort (entriesList , new Comparator <SVNDirEntry >() {
482483 @ Override
483484 public int compare (SVNDirEntry o1 , SVNDirEntry o2 ) {
484485 if (o1 .getRevision () < o2 .getRevision ()) {
@@ -490,11 +491,16 @@ public int compare(SVNDirEntry o1, SVNDirEntry o2) {
490491 return 0 ;
491492 }
492493 });
493- for (SVNDirEntry entry : list ) {
494- if (entry .getKind () == SVNNodeKind .DIR && entry .getName ().startsWith (subdirStartsWith )) {
495- res .add (path + entry .getName ());
494+ Iterator <SVNDirEntry > entriesIterator = entriesList .iterator ();
495+ while (entriesIterator .hasNext ()) {
496+ SVNDirEntry entry = (SVNDirEntry ) entriesIterator .next ();
497+
498+ if (entry .getKind () == SVNNodeKind .DIR ) {
499+ res .add ((path .isEmpty () ? "" : StringUtils .appendIfMissing (path , "/" )) + entry .getName ());
500+ res .addAll (listEntries ((path .equals ("" )) ? entry .getName ( ) : path + entry .getName ()));
496501 }
497502 }
503+
498504 return res ;
499505 }
500506
@@ -693,7 +699,7 @@ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
693699 @ Override
694700 public List <VCSTag > getTags () {
695701 try {
696- List <String > entries = listEntries (TAGS_PATH , "" );
702+ List <String > entries = listEntries (TAGS_PATH );
697703
698704 List <VCSTag > res = new ArrayList <>();
699705 SVNTagBaseCommit handler ;
@@ -748,8 +754,19 @@ public void checkout(String branchName, String targetPath, String revision) {
748754 @ Override
749755 public List <VCSTag > getTagsOnRevision (String revision ) {
750756 try {
751- List <String > tagEntries = listEntries (TAGS_PATH , "" );
752757 List <VCSTag > res = new ArrayList <>();
758+ if (repository .checkPath (TAGS_PATH , -1 ) == SVNNodeKind .NONE ) {
759+ return res ;
760+ }
761+ List <String > tagEntries = new ArrayList <>();
762+ @ SuppressWarnings ("unchecked" )
763+ Collection <SVNDirEntry > entries = repository .getDir (TAGS_PATH , -1 , null , (Collection <SVNDirEntry >) null );
764+ for (SVNDirEntry entry : entries ) {
765+ if (entry .getKind () == SVNNodeKind .DIR ) {
766+ tagEntries .add (TAGS_PATH + entry .getName ());
767+ }
768+ }
769+
753770 SVNTagBaseCommit handler ;
754771 for (String tagEntryStr : tagEntries ) {
755772
0 commit comments