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:
commit
4c77f62ccf
|
@ -997,6 +997,9 @@ private void deleteOrphans() {
|
||||||
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 -> {
|
||||||
|
|
|
@ -1287,7 +1287,7 @@ private static void delete(File file, int depth, LockFile rLck)
|
||||||
File dir = file.getParentFile();
|
File dir = file.getParentFile();
|
||||||
for (int i = 0; i < depth; ++i) {
|
for (int i = 0; i < depth; ++i) {
|
||||||
try {
|
try {
|
||||||
Files.delete(dir.toPath());
|
Files.deleteIfExists(dir.toPath());
|
||||||
} catch (DirectoryNotEmptyException e) {
|
} catch (DirectoryNotEmptyException e) {
|
||||||
// Don't log; normal case when there are other refs with the
|
// Don't log; normal case when there are other refs with the
|
||||||
// same prefix
|
// same prefix
|
||||||
|
|
Loading…
Reference in New Issue