diff options
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java index 19d06a23f8..73b285afc1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaWindow.java @@ -160,6 +160,7 @@ final class DeltaWindow { clear(n); } res.set(next); + clearWindowOnTypeSwitch(); if (res.object.isEdge() || res.object.doNotAttemptDelta()) { // We don't actually want to make a delta for @@ -194,6 +195,15 @@ final class DeltaWindow { return DeltaIndex.estimateIndexSize(len) - len; } + private void clearWindowOnTypeSwitch() { + DeltaWindowEntry p = res.prev; + if (!p.empty() && res.type() != p.type()) { + for (; p != res; p = p.prev) { + clear(p); + } + } + } + private void clear(DeltaWindowEntry ent) { if (ent.index != null) loaded -= ent.index.getIndexSize(); @@ -258,12 +268,6 @@ final class DeltaWindow { private boolean delta(final DeltaWindowEntry src) throws IOException { - // Objects must use only the same type as their delta base. - if (src.type() != res.type()) { - keepInWindow(); - return NEXT_RES; - } - // If the sizes are radically different, this is a bad pairing. if (res.size() < src.size() >>> 4) return NEXT_SRC; |