diff options
author | Robin Stocker <robin@nibor.org> | 2013-12-03 22:25:40 +0100 |
---|---|---|
committer | Robin Stocker <robin@nibor.org> | 2013-12-03 22:30:14 +0100 |
commit | f4dae204a6a2a1a85e8a90a5e89187f3415099e3 (patch) | |
tree | 9f239f3ceb3135fe4aca3f100d3c43b1cefc6aba /org.eclipse.jgit.test | |
parent | 7dc8a4f089c1ca4762cf6fbf2e77898607a5820a (diff) | |
download | jgit-f4dae204a6a2a1a85e8a90a5e89187f3415099e3.tar.gz jgit-f4dae204a6a2a1a85e8a90a5e89187f3415099e3.zip |
Fix IgnoreRule#isMatch returning wrong result due to missing reset
The matcher has to be reset before using it, as was already done in the
other cases.
Bug: 423039
Change-Id: I87abaa7ad7f0aac8651db6e88d41427cacb4d776
Also-by: Ondrej Vrabec <ovrabec@netbeans.org>
Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java index d911efc1d1..aa98696b24 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java @@ -340,6 +340,18 @@ public class IgnoreMatcherTest { assertEquals(r.getPattern(), "/patter?"); } + @Test + public void testResetState() { + String pattern = "/build/*"; + String target = "/build"; + // Don't use the assert methods of this class, as we want to test + // whether the state in IgnoreRule is reset properly + IgnoreRule r = new IgnoreRule(pattern); + // Result should be the same for the same inputs + assertFalse(r.isMatch(target, true)); + assertFalse(r.isMatch(target, true)); + } + /** * Check for a match. If target ends with "/", match will assume that the * target is meant to be a directory. |