Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  Fix NoSuchFileException during directory cleanup in RefDirectory
  Externalize warning message in RefDirectory.delete()
  Suppress warning for trying to delete non-empty directory

Change-Id: I191d56e3c0f11cf53076b06c7e7a05492c7a03f1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-09-12 17:02:09 +09:00
commit 83c0369e29
3 changed files with 5 additions and 2 deletions

View File

@ -698,6 +698,7 @@ truncatedHunkOldLinesMissing=Truncated hunk, at least {0} old lines is missing
tSizeMustBeGreaterOrEqual1=tSize must be >= 1 tSizeMustBeGreaterOrEqual1=tSize must be >= 1
unableToCheckConnectivity=Unable to check connectivity. unableToCheckConnectivity=Unable to check connectivity.
unableToCreateNewObject=Unable to create new object: {0} unableToCreateNewObject=Unable to create new object: {0}
unableToRemovePath=Unable to remove path ''{0}''
unableToStore=Unable to store {0}. unableToStore=Unable to store {0}.
unableToWrite=Unable to write {0} unableToWrite=Unable to write {0}
unauthorized=Unauthorized unauthorized=Unauthorized

View File

@ -759,6 +759,7 @@ public static JGitText get() {
/***/ public String tSizeMustBeGreaterOrEqual1; /***/ public String tSizeMustBeGreaterOrEqual1;
/***/ public String unableToCheckConnectivity; /***/ public String unableToCheckConnectivity;
/***/ public String unableToCreateNewObject; /***/ public String unableToCreateNewObject;
/***/ public String unableToRemovePath;
/***/ public String unableToStore; /***/ public String unableToStore;
/***/ public String unableToWrite; /***/ public String unableToWrite;
/***/ public String unauthorized; /***/ public String unauthorized;

View File

@ -1287,13 +1287,14 @@ private static void delete(final File file, final 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
break; break;
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Unable to remove path {}", dir, e); LOG.warn(MessageFormat.format(JGitText.get().unableToRemovePath,
dir), e);
break; break;
} }
dir = dir.getParentFile(); dir = dir.getParentFile();