Ensure GC.deleteOrphans() can delete read-only orphaned files on Windows

Reported in https://www.eclipse.org/lists/jgit-dev/msg04005.html

Change-Id: I140a49a7f65a76aa2b67ec8d286a3d2506ae499a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2020-10-22 09:25:55 +02:00
parent dd593205a0
commit e23bdf1c7c
1 changed files with 2 additions and 1 deletions

View File

@ -978,7 +978,8 @@ private void deleteOrphans() {
} else {
if (base == null || !n.startsWith(base)) {
try {
Files.delete(packDir.resolve(n));
FileUtils.delete(packDir.resolve(n).toFile(),
FileUtils.RETRY | FileUtils.SKIP_MISSING);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}