Преглед на файлове

GC: delete empty directories after purging loose objects

In order to limit the number of directories we check for emptiness only
consider fanout directories which contained unreferenced loose objects
we deleted in the same gc run.

Change-Id: Idf8d512867ee1c8ed40bd55752122ce83a98ffa2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v4.6.1.201703071140-r
Matthias Sohn преди 7 години
родител
ревизия
18cda3888c
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7
    0
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

+ 7
- 0
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java Целия файл

@@ -475,12 +475,19 @@ public class GC {
// loose objects. Make a last check, though, to avoid deleting objects
// that could have been referenced while the candidates list was being
// built (by an incoming push, for example).
Set<File> touchedFanout = new HashSet<>();
for (File f : deletionCandidates.values()) {
if (f.lastModified() < expireDate) {
f.delete();
touchedFanout.add(f.getParentFile());
}
}

for (File f : touchedFanout) {
FileUtils.delete(f,
FileUtils.EMPTY_DIRECTORIES_ONLY | FileUtils.IGNORE_ERRORS);
}

repo.getObjectDatabase().close();
}


Loading…
Отказ
Запис