diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 00:29:39 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-11-27 00:29:53 +0100 |
commit | a74c0cd333c11658afac2fd931f02bf6e1909153 (patch) | |
tree | 65e00c74d62e639ed1511096c5495d035594e3ad /org.eclipse.jgit | |
parent | 044e70511a91144dc30205ff810e91b3808ce01e (diff) | |
parent | fdcdfc37a302ca1ff6077bbae45f6a79450c3bfe (diff) | |
download | jgit-a74c0cd333c11658afac2fd931f02bf6e1909153.tar.gz jgit-a74c0cd333c11658afac2fd931f02bf6e1909153.zip |
Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
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: I82576ad0f61cf3ff11b54691b32666c61401ad9b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
4 files changed, 15 insertions, 7 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 26b2580693..8890c9fa60 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -210,6 +210,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 60d1dab23f..01c8b3782a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -271,6 +271,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 08bb6cb7fa..0ff3f615bf 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; @@ -978,11 +980,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; @@ -990,12 +996,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); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java index bded527519..4f2e558b26 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java @@ -42,8 +42,6 @@ */ package org.eclipse.jgit.lib; -import org.eclipse.jgit.lib.AnyObjectId; - /** * A .gitmodules file found in the pack. Store the blob of the file itself (e.g. * to access its contents) and the tree where it was found (e.g. to check if it |