Merge branch 'stable-5.0'

* stable-5.0:
  Fix NoSuchFileException in GC.deleteTempPacksIdx()
  Fix NoSuchFileException during directory cleanup in RefDirectory

Change-Id: I35bd4bcbeac2430f674ccb6b947ac3776cec8a82
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-08-27 17:05:23 +09:00 committed by Matthias Sohn
commit 4c77f62ccf
2 changed files with 4 additions and 1 deletions

View File

@ -997,6 +997,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 -> {

View File

@ -1287,7 +1287,7 @@ private static void delete(File file, int depth, LockFile rLck)
File dir = file.getParentFile();
for (int i = 0; i < depth; ++i) {
try {
Files.delete(dir.toPath());
Files.deleteIfExists(dir.toPath());
} catch (DirectoryNotEmptyException e) {
// Don't log; normal case when there are other refs with the
// same prefix