示例#1
0
 /** Recursively walks down a directory tree and collects the paths of all git repositories. */
 private static void getGitDirsInChildren(File localFile, IPath path, Map<IPath, File> gitDirs)
     throws CoreException {
   if (localFile.exists() && localFile.isDirectory()) {
     if (RepositoryCache.FileKey.isGitRepository(localFile, FS.DETECTED)) {
       gitDirs.put(path.addTrailingSeparator(), localFile);
       return;
     } else if (RepositoryCache.FileKey.isGitRepository(
         new File(localFile, Constants.DOT_GIT), FS.DETECTED)) {
       gitDirs.put(path.addTrailingSeparator(), new File(localFile, Constants.DOT_GIT));
       return;
     }
     File[] folders =
         localFile.listFiles(
             new FileFilter() {
               public boolean accept(File file) {
                 return file.isDirectory() && !file.getName().equals(Constants.DOT_GIT);
               }
             });
     for (File folder : folders) {
       getGitDirsInChildren(folder, path.append(folder.getName()), gitDirs);
     }
     return;
   }
 }