Pack heads = null;
if (!allHeadsAndTags.isEmpty()) {
heads = writePack(allHeadsAndTags, PackWriter.NONE, allTags,
- refsToExcludeFromBitmap, tagTargets, excluded);
+ refsToExcludeFromBitmap, tagTargets, excluded, true);
if (heads != null) {
ret.add(heads);
excluded.add(0, heads.getIndex());
}
if (!nonHeads.isEmpty()) {
Pack rest = writePack(nonHeads, allHeadsAndTags, PackWriter.NONE,
- PackWriter.NONE, tagTargets, excluded);
+ PackWriter.NONE, tagTargets, excluded, false);
if (rest != null)
ret.add(rest);
}
if (!txnHeads.isEmpty()) {
Pack txn = writePack(txnHeads, PackWriter.NONE, PackWriter.NONE,
- PackWriter.NONE, null, excluded);
+ PackWriter.NONE, null, excluded, false);
if (txn != null)
ret.add(txn);
}
private Pack writePack(@NonNull Set<? extends ObjectId> want,
@NonNull Set<? extends ObjectId> have, @NonNull Set<ObjectId> tags,
@NonNull Set<ObjectId> excludedRefsTips,
- Set<ObjectId> tagTargets, List<ObjectIdSet> excludeObjects)
+ Set<ObjectId> tagTargets, List<ObjectIdSet> excludeObjects, boolean createBitmap)
throws IOException {
checkCancelled();
File tmpPack = null;
if (excludeObjects != null)
for (ObjectIdSet idx : excludeObjects)
pw.excludeObjects(idx);
+ pw.setCreateBitmaps(createBitmap);
pw.preparePack(pm, want, have, PackWriter.NONE,
union(tags, excludedRefsTips));
if (pw.getObjectCount() == 0)
private boolean useBitmaps;
+ private boolean createBitmaps = true;
+
private boolean ignoreMissingUninteresting = true;
private boolean pruneCurrentObjectList;
this.useBitmaps = useBitmaps;
}
+ /**
+ * Whether to generate bitmaps.
+ *
+ * @param createBitmaps
+ * if set to true, bitmaps will be generated when creating a pack.
+ */
+ public void setCreateBitmaps(boolean createBitmaps) {
+ this.createBitmaps = createBitmaps;
+ }
+
+ /**
+ * Whether the bitmap file is to be created by this PackWriter.
+ *
+ * @return {@code true} if the bitmap file is to be created by this
+ * PackWriter.
+ */
+ public boolean isCreateBitmaps() {
+ return createBitmaps;
+ }
+
/**
* Whether the index file cannot be created by this PackWriter.
*
canBuildBitmaps = config.isBuildBitmaps()
&& !shallowPack
&& have.isEmpty()
- && (excludeInPacks == null || excludeInPacks.length == 0);
+ && createBitmaps;
if (!shallowPack && useBitmaps) {
BitmapIndex bitmapIndex = reader.getBitmapIndex();
if (bitmapIndex != null) {