// 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());
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
/***/ public String binaryHunkInvalidLength;
/***/ public String binaryHunkLineTooShort;
/***/ public String binaryHunkMissingNewline;
+ /***/ public String bitmapAccessErrorForPackfile;
+ /***/ public String bitmapFailedToGet;
/***/ public String bitmapMissingObject;
/***/ public String bitmapsMustBePrepared;
/***/ public String blameNotCommittedYet;
return bitmapIdx;
}
+ synchronized void refreshBitmapIndex(PackFile bitmapIndexFile) {
+ this.bitmapIdx = null;
+ this.invalid = false;
+ this.bitmapIdxFile = bitmapIndexFile;
+ try {
+ getBitmapIndex();
+ } catch (IOException e) {
+ LOG.warn(JGitText.get().bitmapFailedToGet, bitmapIdxFile, e);
+ this.bitmapIdx = null;
+ this.bitmapIdxFile = null;
+ }
+ }
+
private synchronized PackReverseIndex getReverseIdx() throws IOException {
if (reverseIdx == null)
reverseIdx = new PackReverseIndex(idx());
}
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));
}
&& !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;
}