summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2014-03-12 12:01:56 -0700
committerShawn Pearce <spearce@spearce.org>2014-03-12 16:06:10 -0700
commite2f63788470a1cdd2d591505a00dd13ff1bf6a34 (patch)
treedd309af5affb4a1f650d62e008ca3b056b4f81ac /org.eclipse.jgit.test/tst
parented3879e38964c8d41068c1171161bad2be0d3500 (diff)
downloadjgit-e2f63788470a1cdd2d591505a00dd13ff1bf6a34.tar.gz
jgit-e2f63788470a1cdd2d591505a00dd13ff1bf6a34.zip
Change DirCacheCheckout to verify path using ObjectChecker
Reuse the generic logic in ObjectChecker to examine paths. This required extracting the scanner loop to check for bad characters within the path name segment. Change-Id: I02e964d114fb544a0c1657790d5367c3a2b09dff
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java10
1 files changed, 10 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 8cdb0ae350..06745650ca 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
@@ -1450,6 +1450,16 @@ public class ObjectCheckerTest {
}
@Test
+ public void testRejectNulInPathSegment() {
+ try {
+ checker.checkPathSegment(Constants.encodeASCII("a\u0000b"), 0, 3);
+ fail("incorrectly accepted NUL in middle of name");
+ } catch (CorruptObjectException e) {
+ assertEquals("name contains byte 0x00", e.getMessage());
+ }
+ }
+
+ @Test
public void testRejectSpaceAtEndOnWindows() {
checker.setSafeForWindows(true);
try {