aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2024-01-10 19:38:46 +0000
committerMatthias Sohn <matthias.sohn@sap.com>2024-02-20 22:54:54 +0100
commit3e624306dea4de6f7a78a7bcf34a57882f731a2d (patch)
tree73cb3406d8d5eb70c1c75be65f47dae2ce2ef0d0 /org.eclipse.jgit.test
parentacf21c0bc6a63a3d20fca92757b992a1f2d55f41 (diff)
downloadjgit-3e624306dea4de6f7a78a7bcf34a57882f731a2d.tar.gz
jgit-3e624306dea4de6f7a78a7bcf34a57882f731a2d.zip
Allow to discover bitmap on disk created after the packfile
When the bitmap file was created *after* a packfile had been loaded into the memory, JGit was unable to discover them. That happed because of two problems: 1. The PackDirectory.getPacks() does not implement the usual while loop that is scanning through the packs directory as in the other parts of JGit. 2. The scan packs does not look for newly created bitmap files if the packfile is already loaded in memory. Implement the normal packfiles scanning whenever the PackDirectory needs to return a list of packs, and make sure that any reused Pack object would have its associated bitmap properly refreshed from disk. Adapt the assertions in GcConcurrentTest with the rescanned list of Pack from the objects/packs directory. Bug: jgit-15 Change-Id: I2ed576cefd78a0e128b175228a59c9af51523d7b
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java
index 1519873b62..96a064989b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java
@@ -186,13 +186,12 @@ public class GcConcurrentTest extends GcTestCase {
// make sure gc() has caused creation of a new packfile
assertNotEquals(oldPackName, newPackName);
- // Even when asking again for the set of packfiles outdated data
- // will be returned. As long as the repository can work on cached data
- // it will do so and not detect that a new packfile exists.
- assertNotEquals(getSinglePack(repository).getPackName(), newPackName);
+ // When asking again for the set of packfiles the new updated data
+ // will be returned because of the rescan of the pack directory.
+ assertEquals(getSinglePack(repository).getPackName(), newPackName);
- // Only when accessing object content it is required to rescan the pack
- // directory and the new packfile will be detected.
+ // When accessing object content the new packfile refreshed from
+ // the rescan triggered from the list of packs.
repository.getObjectDatabase().open(b).getSize();
assertEquals(getSinglePack(repository).getPackName(), newPackName);
assertNotNull(getSinglePack(repository).getBitmapIndex());