diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2024-02-21 18:18:31 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-02-21 18:18:31 +0100 |
commit | 5481bfda90e403d49156b04446b06a8efd304449 (patch) | |
tree | 0b802d663c5dbbd8802d3018bfd5513284d29ca0 /org.eclipse.jgit/src | |
parent | 3d4a4bd9303c5ec524e375291f4250093be2bec4 (diff) | |
parent | 9377d3190d668827a24a5ff0c7ad9eeacb19bb7d (diff) | |
download | jgit-5481bfda90e403d49156b04446b06a8efd304449.tar.gz jgit-5481bfda90e403d49156b04446b06a8efd304449.zip |
Merge branch 'stable-6.8'
* stable-6.8:
Delete org.eclipse.jgit.ssh.apache.agent/bin/.project
Allow to discover bitmap on disk created after the packfile
Change-Id: I08095dfaefb963876d993383cb35acc6b75d7691
Diffstat (limited to 'org.eclipse.jgit/src')
3 files changed, 29 insertions, 4 deletions
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 a84b9d0dc7..ef464e3172 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -94,6 +94,8 @@ public class JGitText extends TranslationBundle { /***/ public String binaryHunkInvalidLength; /***/ public String binaryHunkLineTooShort; /***/ public String binaryHunkMissingNewline; + /***/ public String bitmapAccessErrorForPackfile; + /***/ public String bitmapFailedToGet; /***/ public String bitmapMissingObject; /***/ public String bitmapsMustBePrepared; /***/ public String bitmapUseNoopNoListener; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java index 3866c9fd90..212dbb20aa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/Pack.java @@ -1173,6 +1173,19 @@ public class Pack implements Iterable<PackIndex.MutableEntry> { return null; } + synchronized void refreshBitmapIndex(PackFile bitmapIndexFile) { + this.bitmapIdx = Optionally.empty(); + this.invalid = false; + this.bitmapIdxFile = bitmapIndexFile; + try { + getBitmapIndex(); + } catch (IOException e) { + LOG.warn(JGitText.get().bitmapFailedToGet, bitmapIdxFile, e); + this.bitmapIdx = Optionally.empty(); + this.bitmapIdxFile = null; + } + } + private synchronized PackReverseIndex getReverseIdx() throws IOException { if (invalid) { throw new PackInvalidException(packFile, invalidatingCause); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java index b1da1cb159..8221cff442 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java @@ -118,10 +118,13 @@ class PackDirectory { } Collection<Pack> getPacks() { - PackList list = packList.get(); - if (list == NO_PACKS) { - list = scanPacks(list); - } + PackList list; + do { + list = packList.get(); + if (list == NO_PACKS) { + list = scanPacks(list); + } + } while (searchPacksAgain(list)); Pack[] packs = list.packs; return Collections.unmodifiableCollection(Arrays.asList(packs)); } @@ -457,6 +460,13 @@ class PackDirectory { && !oldPack.getFileSnapshot().isModified(packFile)) { forReuse.remove(packFile.getName()); list.add(oldPack); + try { + if(oldPack.getBitmapIndex() == null) { + oldPack.refreshBitmapIndex(packFilesByExt.get(BITMAP_INDEX)); + } + } catch (IOException e) { + LOG.warn(JGitText.get().bitmapAccessErrorForPackfile, oldPack.getPackName(), e); + } continue; } |