Browse Source

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>
stable-5.1
David Pursehouse 6 years ago committed by Matthias Sohn
parent
commit
4c77f62ccf
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java

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

@ -997,6 +997,9 @@ public class GC {
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 -> {

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java

@ -1287,7 +1287,7 @@ public class RefDirectory extends RefDatabase {
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

Loading…
Cancel
Save