aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-07-24 23:26:43 +0200
committerAndrey Loskutov <loskutov@gmx.de>2015-08-12 13:44:58 -0400
commit63bc1d862d33bc99b68efddece2e69fb7ae04734 (patch)
tree0822fa85cabbbd3bf0e5999a87d72a0cb9518eba /org.eclipse.jgit.test/tst
parent6bc6e9520e99f012a8d516ae8ac135f440efd38e (diff)
downloadjgit-63bc1d862d33bc99b68efddece2e69fb7ae04734.tar.gz
jgit-63bc1d862d33bc99b68efddece2e69fb7ae04734.zip
Consider original file mode while checking parent ignore rules
The WorkingTreeIterator.isEntryIgnored() should use originally requested file mode while descending to the file tree root and checking ignore rules. Original code asking isEntryIgnored() on a file was using directory mode instead if the .gitignore was not located in the same directory. Bug: 473506 Change-Id: I9f16ba714c3ea9e6585e9c11623270dbdf4fb1df Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
index 9c23f3ca35..9722ac6750 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
@@ -355,6 +355,56 @@ public class IgnoreNodeTest extends RepositoryTestCase {
}
@Test
+ public void testSlashMatchesDirectory() throws IOException {
+ writeIgnoreFile(".gitignore", "out2/");
+
+ writeTrashFile("out1/out1", "");
+ writeTrashFile("out1/out2", "");
+ writeTrashFile("out2/out1", "");
+ writeTrashFile("out2/out2", "");
+
+ beginWalk();
+ assertEntry(F, tracked, ".gitignore");
+ assertEntry(D, tracked, "out1");
+ assertEntry(F, tracked, "out1/out1");
+ assertEntry(F, tracked, "out1/out2");
+ assertEntry(D, ignored, "out2");
+ assertEntry(F, ignored, "out2/out1");
+ assertEntry(F, ignored, "out2/out2");
+ endWalk();
+ }
+
+ @Test
+ public void testWildcardWithSlashMatchesDirectory() throws IOException {
+ writeIgnoreFile(".gitignore", "out2*/");
+
+ writeTrashFile("out1/out1.txt", "");
+ writeTrashFile("out1/out2", "");
+ writeTrashFile("out1/out2.txt", "");
+ writeTrashFile("out1/out2x/a", "");
+ writeTrashFile("out2/out1.txt", "");
+ writeTrashFile("out2/out2.txt", "");
+ writeTrashFile("out2x/out1.txt", "");
+ writeTrashFile("out2x/out2.txt", "");
+
+ beginWalk();
+ assertEntry(F, tracked, ".gitignore");
+ assertEntry(D, tracked, "out1");
+ assertEntry(F, tracked, "out1/out1.txt");
+ assertEntry(F, tracked, "out1/out2");
+ assertEntry(F, tracked, "out1/out2.txt");
+ assertEntry(D, ignored, "out1/out2x");
+ assertEntry(F, ignored, "out1/out2x/a");
+ assertEntry(D, ignored, "out2");
+ assertEntry(F, ignored, "out2/out1.txt");
+ assertEntry(F, ignored, "out2/out2.txt");
+ assertEntry(D, ignored, "out2x");
+ assertEntry(F, ignored, "out2x/out1.txt");
+ assertEntry(F, ignored, "out2x/out2.txt");
+ endWalk();
+ }
+
+ @Test
public void testWithSlashDoesNotMatchInSubDirectory() throws IOException {
writeIgnoreFile(".gitignore", "a/b");
writeTrashFile("a/a", "");