diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2024-02-21 17:41:44 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-02-21 17:47:28 +0100 |
commit | 7ba0cfa0c1c91838af9dc1b551b73ae2c4dc40ef (patch) | |
tree | 9b10aa7c7f1a69cdaf7831e08dc78a46dcab1e1a /org.eclipse.jgit | |
parent | bf70c9f4c2e35548bc6d7853284b2c4d5e1d29ef (diff) | |
parent | 89bf38087a9e9a0536742f5d9d408856e5ad2dc7 (diff) | |
download | jgit-7ba0cfa0c1c91838af9dc1b551b73ae2c4dc40ef.tar.gz jgit-7ba0cfa0c1c91838af9dc1b551b73ae2c4dc40ef.zip |
Merge branch 'stable-6.6' into stable-6.7
* stable-6.6:
Delete org.eclipse.jgit.ssh.apache.agent/bin/.project
Allow to discover bitmap on disk created after the packfile
Change-Id: I2bbc8c9a4ed45d37fa7ba63b2afd5511b6cf47a2
Diffstat (limited to 'org.eclipse.jgit')
4 files changed, 31 insertions, 4 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 fe5fd4cfd6..177ceb167a 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -64,6 +64,8 @@ binaryHunkDecodeError=Binary hunk, line {0}: invalid input binaryHunkInvalidLength=Binary hunk, line {0}: input corrupt; expected length byte, got 0x{1} binaryHunkLineTooShort=Binary hunk, line {0}: input ended prematurely binaryHunkMissingNewline=Binary hunk, line {0}: input line not terminated by newline +bitmapAccessErrorForPackfile=Error whilst trying to access bitmap file for {} +bitmapFailedToGet=Failed to get bitmap index file {} bitmapMissingObject=Bitmap at {0} is missing {1}. bitmapsMustBePrepared=Bitmaps must be prepared before they may be written. blameNotCommittedYet=Not Committed Yet 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 cdad7cceaf..02af5b4d81 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -93,6 +93,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 blameNotCommittedYet; 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 4f1d348844..333967c5e5 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 @@ -1177,6 +1177,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 28f6250a22..c34229dedc 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; } |