aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2011-01-18 17:14:15 -0800
committerChris Aniszczyk <caniszczyk@gmail.com>2011-01-25 16:52:22 -0600
commitd62350d907f5ec91f17c645b8cfb2c76edf1cb5e (patch)
tree603aad918742cb93e002542178e15d0d4a5dd195 /org.eclipse.jgit
parent1bf0c3cdb1aecac41284e63b2daed2d92b908d3d (diff)
downloadjgit-d62350d907f5ec91f17c645b8cfb2c76edf1cb5e.tar.gz
jgit-d62350d907f5ec91f17c645b8cfb2c76edf1cb5e.zip
Ensure all deltas were resolved in a pack
If a pack uses OFS_DELTA only (e.g. its an initial push to a repository) and PackParser's implementation is broken such that the delta chain that hangs below a particular object offset is empty, the entryCount won't match the expected objectCount. Fail fast rather than claiming the stream was parsed correctly. The current implementation is not broken as described above. I broke the code when I implemented my own new subclass of PackParser (which incorrectly mucked with the object offset information), leading me to discover this consistency check was missing. Change-Id: I07540f0ae1144ef6f3bda48774dbdefb8876e1d3 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
index 54e7dd989f..06819d3efe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
@@ -409,6 +409,12 @@ public abstract class PackParser {
}
resolveDeltasWithExternalBases(progress);
+
+ if (entryCount < objectCount) {
+ throw new IOException(MessageFormat.format(JGitText
+ .get().packHasUnresolvedDeltas,
+ (objectCount - entryCount)));
+ }
}
}