diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectToPack.java index b4bf37a5e..c7ef2c913 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectToPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectToPack.java @@ -62,6 +62,12 @@ class LocalObjectToPack extends ObjectToPack { super(obj); } + @Override + protected void clearReuseAsIs() { + super.clearReuseAsIs(); + pack = null; + } + @Override public void select(StoredObjectRepresentation ref) { LocalObjectRepresentation ptr = (LocalObjectRepresentation) ref; 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 afab01752..d3c409d9d 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 @@ -199,7 +199,14 @@ public class ObjectToPack extends PackedObjectInfo { flags |= REUSE_AS_IS; } - void clearReuseAsIs() { + /** + * Forget the reuse information previously stored. + *

+ * Implementations may subclass this method, but they must also invoke the + * super version with {@code super.clearReuseAsIs()} to ensure the flag is + * properly cleared for the writer. + */ + protected void clearReuseAsIs() { flags &= ~REUSE_AS_IS; }