diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 01:01:17 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 01:01:31 +0100 |
commit | 480b00f1c799bbd09bf747dca88c23a4844931cd (patch) | |
tree | 927b9f1204f9dd770a02963f590c703d129cf0ab /org.eclipse.jgit | |
parent | 916b367c27af8d491d5a385ad7cb140fa27e6594 (diff) | |
parent | 95846863cbb929d2433d7a38151c2c7aebedafb0 (diff) | |
download | jgit-480b00f1c799bbd09bf747dca88c23a4844931cd.tar.gz jgit-480b00f1c799bbd09bf747dca88c23a4844931cd.zip |
Merge branch 'stable-5.5' into stable-5.6
* stable-5.5:
Prepare 5.3.9-SNAPSHOT builds
JGit v5.3.8.202011260953-r
Prepare 5.1.15-SNAPSHOT builds
JGit v5.1.14.202011251942-r
GC#deleteOrphans: log warning for deleted orphaned files
GC#deleteOrphans: handle failure to list files in pack directory
Ensure that GC#deleteOrphans respects pack lock
Update API warning filters
Remove unused imports
Change-Id: I00c8ddad0059a20a978743dfb7ad1b513dc7fef6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
3 files changed, 15 insertions, 5 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 8ee6e4736e..9e483a6c61 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -214,6 +214,7 @@ deepenNotWithDeepen=Cannot combine deepen with deepen-not deepenSinceWithDeepen=Cannot combine deepen with deepen-since deleteBranchUnexpectedResult=Delete branch returned unexpected result {0} deleteFileFailed=Could not delete file {0} +deletedOrphanInPackDir=Deleted orphaned file {} deleteRequiresZeroNewId=Delete requires new ID to be zero deleteTagUnexpectedResult=Delete tag returned unexpected result {0} deletingNotSupported=Deleting {0} not supported. 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 0cea60fd95..535306967b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -275,6 +275,7 @@ public class JGitText extends TranslationBundle { /***/ public String deepenSinceWithDeepen; /***/ public String deleteBranchUnexpectedResult; /***/ public String deleteFileFailed; + /***/ public String deletedOrphanInPackDir; /***/ public String deleteRequiresZeroNewId; /***/ public String deleteTagUnexpectedResult; /***/ public String deletingNotSupported; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index 0619dfd83c..5edcf37420 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -148,6 +148,8 @@ public class GC { private static final String INDEX_EXT = "." + PackExt.INDEX.getExtension(); //$NON-NLS-1$ + private static final String KEEP_EXT = "." + PackExt.KEEP.getExtension(); //$NON-NLS-1$ + private static final int DEFAULT_AUTOPACKLIMIT = 50; private static final int DEFAULT_AUTOLIMIT = 6700; @@ -994,11 +996,15 @@ public class GC { fileNames = files.map(path -> path.getFileName().toString()) .filter(name -> (name.endsWith(PACK_EXT) || name.endsWith(BITMAP_EXT) - || name.endsWith(INDEX_EXT))) + || name.endsWith(INDEX_EXT) + || name.endsWith(KEEP_EXT))) + // sort files with same base name in the order: + // .pack, .keep, .index, .bitmap to avoid look ahead .sorted(Collections.reverseOrder()) .collect(Collectors.toList()); - } catch (IOException e1) { - // ignore + } catch (IOException e) { + LOG.error(e.getMessage(), e); + return; } if (fileNames == null) { return; @@ -1006,12 +1012,14 @@ public class GC { String base = null; for (String n : fileNames) { - if (n.endsWith(PACK_EXT)) { + if (n.endsWith(PACK_EXT) || n.endsWith(KEEP_EXT)) { base = n.substring(0, n.lastIndexOf('.')); } else { if (base == null || !n.startsWith(base)) { try { - Files.delete(packDir.resolve(n)); + Path delete = packDir.resolve(n); + Files.delete(delete); + LOG.warn(JGitText.get().deletedOrphanInPackDir, delete); } catch (IOException e) { LOG.error(e.getMessage(), e); } |