aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2013-02-28 23:47:44 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2014-01-19 00:20:42 +0100
commit75b31767c4d5db4883aa9b86c104d3cc8aa72b6d (patch)
tree3cc9c39447f7f3476b7419bfb30b078cac9e8281 /org.eclipse.jgit.test/tst
parent2f425cf30c79917a93eeeac0ee3fcfc7af77d203 (diff)
downloadjgit-75b31767c4d5db4883aa9b86c104d3cc8aa72b6d.tar.gz
jgit-75b31767c4d5db4883aa9b86c104d3cc8aa72b6d.zip
Do not report ignored directories as untracked
Change-Id: I7e3f6b9fb1ac4b99d2cc9a78c63aad86f4fa5744 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
index 51ba5f13ea..64e72e8fc7 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
@@ -467,6 +467,53 @@ public class IndexDiffTest extends RepositoryTestCase {
diff.getUntrackedFolders());
}
+ /**
+ * Test that ignored folders aren't listed as untracked
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUntrackedNotIgnoredFolders() throws Exception {
+ Git git = new Git(db);
+
+ IndexDiff diff = new IndexDiff(db, Constants.HEAD,
+ new FileTreeIterator(db));
+ diff.diff();
+ assertEquals(Collections.EMPTY_SET, diff.getUntrackedFolders());
+
+ writeTrashFile("readme", "");
+ writeTrashFile("sr/com/X.java", "");
+ writeTrashFile("src/com/A.java", "");
+ writeTrashFile("src/org/B.java", "");
+ writeTrashFile("srcs/org/Y.java", "");
+ writeTrashFile("target/com/A.java", "");
+ writeTrashFile("target/org/B.java", "");
+ writeTrashFile(".gitignore", "/target\n/sr");
+
+ git.add().addFilepattern("readme").addFilepattern(".gitignore")
+ .addFilepattern("srcs/").call();
+ git.commit().setMessage("initial").call();
+
+ diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db));
+ diff.diff();
+ assertEquals(new HashSet<String>(Arrays.asList("src")),
+ diff.getUntrackedFolders());
+
+ git.add().addFilepattern("src").call();
+ writeTrashFile("sr/com/X1.java", "");
+ writeTrashFile("src/tst/A.java", "");
+ writeTrashFile("src/tst/B.java", "");
+ writeTrashFile("srcs/com/Y1.java", "");
+ deleteTrashFile(".gitignore");
+
+ diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db));
+ diff.diff();
+ assertEquals(
+ new HashSet<String>(Arrays.asList("srcs/com", "sr", "src/tst",
+ "target")),
+ diff.getUntrackedFolders());
+ }
+
@Test
public void testAssumeUnchanged() throws Exception {
Git git = new Git(db);