Browse Source

Fix NoSuchFileException in GC.deleteTempPacksIdx()

This exception is thrown in GC.deleteTempPacksIdx() if the repository
has no packs.

Bug: 538286
Change-Id: Ieb482be751226baf0843068a0f847e0cdc6e0cb6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.0
Matthias Sohn 6 years ago
parent
commit
ddf56d6f85
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

@ -996,6 +996,9 @@ public class GC {
private void deleteTempPacksIdx() { private void deleteTempPacksIdx() {
Path packDir = repo.getObjectDatabase().getPackDirectory().toPath(); Path packDir = repo.getObjectDatabase().getPackDirectory().toPath();
Instant threshold = Instant.now().minus(1, ChronoUnit.DAYS); Instant threshold = Instant.now().minus(1, ChronoUnit.DAYS);
if (!Files.exists(packDir)) {
return;
}
try (DirectoryStream<Path> stream = try (DirectoryStream<Path> stream =
Files.newDirectoryStream(packDir, "gc_*_tmp")) { //$NON-NLS-1$ Files.newDirectoryStream(packDir, "gc_*_tmp")) { //$NON-NLS-1$
stream.forEach(t -> { stream.forEach(t -> {

Loading…
Cancel
Save