Browse Source

Add doNotDelta flag to ObjectToPack

This flag will later control whether or not PackWriter search for a
delta base for this object.  Edge objects will never get searched,
as the writer won't be outputting them, so they should always have
this flag set on.  Sometime in the future this flag should also be
set for file blobs on file paths that have the "-delta" gitattribute
set in the repository's attributes file.

Change-Id: I6e518e1a6996c8ce00b523727f1b605e400e82c6
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.9
Shawn O. Pearce 15 years ago
parent
commit
823e9a9721
  1. 16
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java
  2. 1
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

16
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java

@ -61,6 +61,8 @@ public class ObjectToPack extends PackedObjectInfo {
private static final int REUSE_AS_IS = 1 << 1;
private static final int DO_NOT_DELTA = 1 << 2;
private static final int TYPE_SHIFT = 5;
private static final int DELTA_SHIFT = 8;
@ -75,7 +77,8 @@ public class ObjectToPack extends PackedObjectInfo {
* <ul>
* <li>1 bit: wantWrite</li>
* <li>1 bit: canReuseAsIs</li>
* <li>3 bits: unused</li>
* <li>1 bit: doNotDelta</li>
* <li>2 bits: unused</li>
* <li>3 bits: type</li>
* <li>--</li>
* <li>24 bits: deltaDepth</li>
@ -207,6 +210,17 @@ public class ObjectToPack extends PackedObjectInfo {
flags &= ~REUSE_AS_IS;
}
boolean isDoNotDelta() {
return (flags & DO_NOT_DELTA) != 0;
}
void setDoNotDelta(boolean noDelta) {
if (noDelta)
flags |= DO_NOT_DELTA;
else
flags &= ~DO_NOT_DELTA;
}
int getFormat() {
if (isReuseAsIs()) {
if (isDeltaRepresentation())

1
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

@ -911,6 +911,7 @@ public class PackWriter {
case Constants.OBJ_BLOB:
ObjectToPack otp = new ObjectToPack(object);
otp.setPathHash(pathHashCode);
otp.setDoNotDelta(true);
edgeObjects.add(otp);
thin = true;
break;

Loading…
Cancel
Save