diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-09-12 14:05:46 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-09-12 14:05:54 +0900 |
commit | db756e914708ff29d93c2cba040aa19ea1a485c6 (patch) | |
tree | 245f501b66174077943d1c1f6570d287ee6e148f /org.eclipse.jgit | |
parent | 81735222c94069edb0e0434b717ab87011b51901 (diff) | |
parent | 667ac8b3189336efbdb0484e212c36beb4ed5338 (diff) | |
download | jgit-db756e914708ff29d93c2cba040aa19ea1a485c6.tar.gz jgit-db756e914708ff29d93c2cba040aa19ea1a485c6.zip |
Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
Fix NoSuchFileException during directory cleanup in RefDirectory
Externalize warning message in RefDirectory.delete()
Suppress warning for trying to delete non-empty directory
Change-Id: I9ec6352b5ff57aa1a3380079dc9165890cc76d49
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
3 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index 8fce30a2af..c9aaa39945 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -649,6 +649,7 @@ truncatedHunkOldLinesMissing=Truncated hunk, at least {0} old lines is missing tSizeMustBeGreaterOrEqual1=tSize must be >= 1 unableToCheckConnectivity=Unable to check connectivity. unableToCreateNewObject=Unable to create new object: {0} +unableToRemovePath=Unable to remove path ''{0}'' unableToStore=Unable to store {0}. unableToWrite=Unable to write {0} unauthorized=Unauthorized diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index a4a970e242..a8dfc2d2a2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -708,6 +708,7 @@ public class JGitText extends TranslationBundle { /***/ public String tSizeMustBeGreaterOrEqual1; /***/ public String unableToCheckConnectivity; /***/ public String unableToCreateNewObject; + /***/ public String unableToRemovePath; /***/ public String unableToStore; /***/ public String unableToWrite; /***/ public String unauthorized; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index 48fdf8119f..8338b2c8a2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -63,6 +63,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.file.DirectoryNotEmptyException; import java.nio.file.Files; import java.security.DigestInputStream; import java.security.MessageDigest; @@ -1092,9 +1093,14 @@ 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 + break; } catch (IOException e) { - LOG.warn("Unable to remove path {}", dir, e); + LOG.warn(MessageFormat.format(JGitText.get().unableToRemovePath, + dir), e); break; } dir = dir.getParentFile(); |