diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 10:58:43 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 10:59:01 +0100 |
commit | 4f2065d145c3fa3f8ad3de28af3ee5dfeb74c765 (patch) | |
tree | c32f15fc0bc553a1cd76e21f4ca96f0e61978c99 /org.eclipse.jgit | |
parent | 9ebbfe93bb3ba0ea170d330fe227f1d8182d7d64 (diff) | |
parent | d4fe93f55bcdf3115a53ac69c1594dd7799e2453 (diff) | |
download | jgit-4f2065d145c3fa3f8ad3de28af3ee5dfeb74c765.tar.gz jgit-4f2065d145c3fa3f8ad3de28af3ee5dfeb74c765.zip |
Merge branch 'stable-5.10'
* stable-5.10:
Remove unused imports
Silence API warnings
Remove erraneously merged source features
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
PacketLineIn: ensure that END != DELIM
Update API warning filters
Remove unused imports
Change-Id: I25f50c3807a4e6b22a264320ea7ed3758e2a75ec
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 c9e48a5c09..12902b9004 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -213,6 +213,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 b761210e63..892657d5d3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -241,6 +241,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 741d86e67f..1f2fe1057f 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 @@ -115,6 +115,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; @@ -961,11 +963,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; @@ -973,13 +979,15 @@ 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 { - FileUtils.delete(packDir.resolve(n).toFile(), + Path delete = packDir.resolve(n); + FileUtils.delete(delete.toFile(), FileUtils.RETRY | FileUtils.SKIP_MISSING); + LOG.warn(JGitText.get().deletedOrphanInPackDir, delete); } catch (IOException e) { LOG.error(e.getMessage(), e); } |