Browse Source

Files should be deleted with "retry" option

Some of our Windows users have reported sporadic file system access
problems related to ObjectDirectory(Inserter) file deletion code in
combination with antiviral/firewall tools. For one of these users the
problem was fairly reproducible and changing deletion to RETRY solved
his problem.

Change-Id: I1e4001d5557fca693b7bac401268599467cb0c9e
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>‌
stable-3.4
Marc Strapetz 11 years ago committed by Robin Rosenberg
parent
commit
59a2dc801c
  1. 10
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
  2. 4
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java

10
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java

@ -557,11 +557,11 @@ public class ObjectDirectory extends FileObjectDatabase {
// If the object is already in the repository, remove temporary file. // If the object is already in the repository, remove temporary file.
// //
if (unpackedObjectCache.isUnpacked(id)) { if (unpackedObjectCache.isUnpacked(id)) {
FileUtils.delete(tmp); FileUtils.delete(tmp, FileUtils.RETRY);
return InsertLooseObjectResult.EXISTS_LOOSE; return InsertLooseObjectResult.EXISTS_LOOSE;
} }
if (!createDuplicate && has(id)) { if (!createDuplicate && has(id)) {
FileUtils.delete(tmp); FileUtils.delete(tmp, FileUtils.RETRY);
return InsertLooseObjectResult.EXISTS_PACKED; return InsertLooseObjectResult.EXISTS_PACKED;
} }
@ -571,7 +571,7 @@ public class ObjectDirectory extends FileObjectDatabase {
// that already exists. We can't be sure renameTo() would // that already exists. We can't be sure renameTo() would
// fail on all platforms if dst exists, so we check first. // fail on all platforms if dst exists, so we check first.
// //
FileUtils.delete(tmp); FileUtils.delete(tmp, FileUtils.RETRY);
return InsertLooseObjectResult.EXISTS_LOOSE; return InsertLooseObjectResult.EXISTS_LOOSE;
} }
if (tmp.renameTo(dst)) { if (tmp.renameTo(dst)) {
@ -592,7 +592,7 @@ public class ObjectDirectory extends FileObjectDatabase {
} }
if (!createDuplicate && has(id)) { if (!createDuplicate && has(id)) {
FileUtils.delete(tmp); FileUtils.delete(tmp, FileUtils.RETRY);
return InsertLooseObjectResult.EXISTS_PACKED; return InsertLooseObjectResult.EXISTS_PACKED;
} }
@ -601,7 +601,7 @@ public class ObjectDirectory extends FileObjectDatabase {
// either. We really don't know what went wrong, so // either. We really don't know what went wrong, so
// fail. // fail.
// //
FileUtils.delete(tmp); FileUtils.delete(tmp, FileUtils.RETRY);
return InsertLooseObjectResult.FAILURE; return InsertLooseObjectResult.FAILURE;
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java

@ -182,7 +182,7 @@ class ObjectDirectoryInserter extends ObjectInserter {
return tmp; return tmp;
} finally { } finally {
if (delete) if (delete)
FileUtils.delete(tmp); FileUtils.delete(tmp, FileUtils.RETRY);
} }
} }
@ -211,7 +211,7 @@ class ObjectDirectoryInserter extends ObjectInserter {
return tmp; return tmp;
} finally { } finally {
if (delete) if (delete)
FileUtils.delete(tmp); FileUtils.delete(tmp, FileUtils.RETRY);
} }
} }

Loading…
Cancel
Save