aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2014-03-11 17:19:37 -0700
committerShawn Pearce <spearce@spearce.org>2014-03-12 15:43:20 -0700
commit2f1bd3618da20886b12b8132e9307bc61f5fe039 (patch)
treed308fb11aab45a22011da00907ea8ed98e99c1c3 /org.eclipse.jgit.test/tst/org
parentefd91ef8a7e9d97fab08a6b9a5e181c846b744cb (diff)
downloadjgit-2f1bd3618da20886b12b8132e9307bc61f5fe039.tar.gz
jgit-2f1bd3618da20886b12b8132e9307bc61f5fe039.zip
Permit ObjectChecker to optionally accept leading '0' in trees
The leading '0' is a broken mode that although incorrect in the Git canonical tree format was created by a couple of libraries frequently used on a popular Git hosting site. Some projects have these modes stuck in their ancient history and cannot easily repair the damage without a full history rewrite. Optionally permit ObjectChecker to ignore them. Bug: 307291 Change-Id: Ib921dfd77ce757e89280d1c00328a88430daef35
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
index 380defaa08..4a4e349cfd 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
@@ -1109,6 +1109,14 @@ public class ObjectCheckerTest {
}
@Test
+ public void testAcceptTreeModeWithZero() throws CorruptObjectException {
+ StringBuilder b = new StringBuilder();
+ entry(b, "040000 a");
+ checker.setAllowLeadingZeroFileMode(true);
+ checker.checkTree(Constants.encodeASCII(b.toString()));
+ }
+
+ @Test
public void testInvalidTreeModeStartsWithZero1() {
final StringBuilder b = new StringBuilder();
entry(b, "0 a");