package org.eclipse.jgit.storage.dfs;
+import static org.eclipse.jgit.storage.dfs.DfsObjDatabase.PackSource.GC;
+import static org.eclipse.jgit.storage.dfs.DfsObjDatabase.PackSource.UNREACHABLE_GARBAGE;
+
import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.storage.dfs.DfsObjDatabase.PackSource;
import org.eclipse.jgit.storage.pack.ObjectToPack;
import org.eclipse.jgit.storage.pack.StoredObjectRepresentation;
public ObjectId getDeltaBase() {
return baseId;
}
+
+ @Override
+ public boolean wasDeltaAttempted() {
+ if (pack != null) {
+ PackSource source = pack.getPackDescription().getPackSource();
+ return source == GC || source == UNREACHABLE_GARBAGE;
+ }
+ return false;
+ }
}
import java.util.Set;
import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.storage.dfs.DfsObjDatabase.PackSource;
import org.eclipse.jgit.storage.pack.PackWriter;
/**
private final String packName;
+ private PackSource packSource;
+
private long lastModified;
private long packSize;
return name.substring(0, dot) + ".idx";
}
+ /** @return the source of the pack. */
+ public PackSource getPackSource() {
+ return packSource;
+ }
+
+ /**
+ * @param source
+ * the source of the pack.
+ * @return {@code this}
+ */
+ public DfsPackDescription setPackSource(PackSource source) {
+ packSource = source;
+ return this;
+ }
+
/** @return time the pack was created, in milliseconds. */
public long getLastModified() {
return lastModified;
@Override
protected DfsPackDescription newPack(PackSource source) {
int id = packId.incrementAndGet();
- return new MemPack("pack-" + id + "-" + source.name(),
+ DfsPackDescription desc = new MemPack(
+ "pack-" + id + "-" + source.name(),
getRepository().getDescription());
+ return desc.setPackSource(source);
}
@Override