summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java2
2 files changed, 12 insertions, 1 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 881b01c312..0076ba124d 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
@@ -166,6 +166,17 @@ public class IgnoreNodeTest extends RepositoryTestCase {
assertEntry(F, tracked, "src/a/b");
}
+ @Test
+ public void testNoPatterns() throws IOException {
+ writeIgnoreFile(".gitignore", "", " ", "# comment", "/");
+ writeTrashFile("a/a", "");
+
+ beginWalk();
+ assertEntry(F, tracked, ".gitignore");
+ assertEntry(D, tracked, "a");
+ assertEntry(F, tracked, "a/a");
+ }
+
private void beginWalk() throws CorruptObjectException {
walk = new TreeWalk(db);
walk.addTree(new FileTreeIterator(db));
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java
index fb65e0ce34..2cddddbe11 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java
@@ -102,7 +102,7 @@ public class IgnoreNode {
String txt;
while ((txt = br.readLine()) != null) {
txt = txt.trim();
- if (txt.length() > 0 && !txt.startsWith("#")) //$NON-NLS-1$
+ if (txt.length() > 0 && !txt.startsWith("#") && !txt.equals("/")) //$NON-NLS-1$ //$NON-NLS-2$
rules.add(new IgnoreRule(txt));
}
}