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>
This commit is contained in:
Matthias Sohn 2018-08-27 01:20:31 +02:00
parent 8ab89ef066
commit ddf56d6f85
1 changed files with 3 additions and 0 deletions

View File

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