do not try to run git gc in <>.git.gc or <>.git.old directories
authorPavel Sher <pavel.sher@jetbrains.com>
Mon, 14 Jan 2019 17:22:30 +0000 (18:22 +0100)
committerPavel Sher <pavel.sher@jetbrains.com>
Mon, 14 Jan 2019 17:22:30 +0000 (18:22 +0100)
git-server/src/jetbrains/buildServer/buildTriggers/vcs/git/Cleanup.java

index 3e5cbc3ad3c56f7ce20e801c2096e96e2ce9d57f..01b67537e1ceb017e6a8ee631fcd63b6ebcd4037 100644 (file)
@@ -123,7 +123,13 @@ public class Cleanup {
   }
 
   private List<File> getAllRepositoryDirs() {
-    return new ArrayList<File>(FileUtil.getSubDirectories(myRepositoryManager.getBaseMirrorsDir()));
+    List<File> dirs = new ArrayList<>();
+    for (File d: FileUtil.getSubDirectories(myRepositoryManager.getBaseMirrorsDir())) {
+      if (d.getName().endsWith(".git")) { // there can be some other directories like .gc or .old, we should ignore them
+        dirs.add(d);
+      }
+    }
+    return dirs;
   }
 
   private void cleanupMonitoringData() {