1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.treewalk;
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertFalse;
14 import static org.junit.Assert.assertTrue;
15
16 import java.io.File;
17
18 import org.eclipse.jgit.junit.RepositoryTestCase;
19 import org.eclipse.jgit.util.FS;
20 import org.junit.Test;
21
22 public class TreeWalkJava7Test extends RepositoryTestCase {
23 @Test
24 public void testSymlinkToDirNotRecursingViaSymlink() throws Exception {
25 org.junit.Assume.assumeTrue(FS.DETECTED.supportsSymlinks());
26 FS fs = db.getFS();
27 assertTrue(fs.supportsSymlinks());
28 writeTrashFile("target/data", "targetdata");
29 fs.createSymLink(new File(trash, "link"), "target");
30 try (TreeWalk tw = new TreeWalk(db)) {
31 tw.setRecursive(true);
32 tw.addTree(new FileTreeIterator(db));
33 assertTrue(tw.next());
34 assertEquals("link", tw.getPathString());
35 assertTrue(tw.next());
36 assertEquals("target/data", tw.getPathString());
37 assertFalse(tw.next());
38 }
39 }
40 }