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>
This commit is contained in:
commit
db756e9147
|
@ -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
|
||||
|
|
|
@ -708,6 +708,7 @@ public static JGitText get() {
|
|||
/***/ public String tSizeMustBeGreaterOrEqual1;
|
||||
/***/ public String unableToCheckConnectivity;
|
||||
/***/ public String unableToCreateNewObject;
|
||||
/***/ public String unableToRemovePath;
|
||||
/***/ public String unableToStore;
|
||||
/***/ public String unableToWrite;
|
||||
/***/ public String unauthorized;
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
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 @@ private static void delete(final File file, final int depth, LockFile rLck)
|
|||
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();
|
||||
|
|
Loading…
Reference in New Issue