diff options
author | Shawn Pearce <spearce@spearce.org> | 2014-04-03 10:24:49 -0700 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2014-04-03 11:15:25 -0700 |
commit | 94330d9cb521e9074ac3d3b4c9a985561e636b5d (patch) | |
tree | 2cc8e79a0574f6765a82904295dbfd402515874d /org.eclipse.jgit.test | |
parent | 39904d6ad4c8aad79be11fff27d96b9d1698e26b (diff) | |
download | jgit-94330d9cb521e9074ac3d3b4c9a985561e636b5d.tar.gz jgit-94330d9cb521e9074ac3d3b4c9a985561e636b5d.zip |
Fix ObjectChecker when normalization is enabled
When safeForMacOS is enabled the checker verifies a name does not
match against another name in the same tree after normalization to
NFC. The check was incorrect and failed when the first name was put
in, rejecting simple trees containing only one file like "F".
Add a test for this simple tree to verify it is accepted.
Fix the test for NFC normalization to actually normalize
and have a collision.
Change-Id: I39e7d71150948872bff6cd2b06bf8dae52aa3c33
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java | 13 |
1 files changed, 11 insertions, 2 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 3f58b7501f..9fc7fca987 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 @@ -1493,8 +1493,8 @@ public class ObjectCheckerTest { } StringBuilder b = new StringBuilder(); - entry(b, "100644 \u00C1"); - entry(b, "100644 \u004a\u0301"); + entry(b, "100644 \u0065\u0301"); + entry(b, "100644 \u00e9"); byte[] data = b.toString().getBytes("UTF-8"); try { checker.setSafeForMacOS(true); @@ -1506,6 +1506,15 @@ public class ObjectCheckerTest { } @Test + public void testInvalidTreeDuplicateNames8() + throws UnsupportedEncodingException, CorruptObjectException { + StringBuilder b = new StringBuilder(); + entry(b, "100644 A"); + checker.setSafeForMacOS(true); + checker.checkTree(b.toString().getBytes("UTF-8")); + } + + @Test public void testRejectNulInPathSegment() { try { checker.checkPathSegment(Constants.encodeASCII("a\u0000b"), 0, 3); |