diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-07-08 17:19:20 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-07-09 19:00:49 -0700 |
commit | 823e9a972100ad197fcb40efb37e1ca33f4bdb01 (patch) | |
tree | bbcfe290f364af32c573a5858263b870cc7abc7f | |
parent | 616bc74cf7f888b3bf9c091e13c954ea45b8d68c (diff) | |
download | jgit-823e9a972100ad197fcb40efb37e1ca33f4bdb01.tar.gz jgit-823e9a972100ad197fcb40efb37e1ca33f4bdb01.zip |
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>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java | 16 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java index cad3aaeec7..4016e92c9d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java +++ b/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()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java index 05e863e551..25e2bea1ab 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java +++ b/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; |