]> source.dussan.org Git - jgit.git/commitdiff
Make ObjectToPack clearReuseAsIs signal available to subclasses 09/1109/1
authorShawn O. Pearce <spearce@spearce.org>
Fri, 9 Jul 2010 15:51:47 +0000 (08:51 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 10 Jul 2010 02:07:45 +0000 (19:07 -0700)
A subclass may want to use this method to release handles that are
caching reuse information.  Make it protected so they can override
it and update themselves.

Change-Id: I2277a56ad28560d2d2d97961cbc74bc7405a70d4
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectToPack.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java

index b4bf37a5e9241c840dac875df244e5240c058c75..c7ef2c91332461d51e72c5a2c0f8b7e5a900fa69 100644 (file)
@@ -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;
index afab017525cacbec6a6de74e5bee8cdc13176a08..d3c409d9d3245833e05f50c3abc4896df7fdad30 100644 (file)
@@ -199,7 +199,14 @@ public class ObjectToPack extends PackedObjectInfo {
                flags |= REUSE_AS_IS;
        }
 
-       void clearReuseAsIs() {
+       /**
+        * Forget the reuse information previously stored.
+        * <p>
+        * 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;
        }