aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-09-26 11:34:02 +0200
committerAndrey Loskutov <loskutov@gmx.de>2015-09-26 11:34:02 +0200
commit4b7daecf4a827b9cf69a76e5cbd8559e8079f4c8 (patch)
tree9d85e54bdb3aa9ddc1c2afa34f54358b74b93ac6
parent6715c36100d097d39e303fe2fbc4c62412c46a4a (diff)
downloadjgit-4b7daecf4a827b9cf69a76e5cbd8559e8079f4c8.tar.gz
jgit-4b7daecf4a827b9cf69a76e5cbd8559e8079f4c8.zip
[ignore rules] Fix for character group matcher
Currently we fail to properly recognize character group if the pattern before character group contains opening bracket. See comment from Sebastien Arod on https://git.eclipse.org/r/56678/ Change-Id: I70d3657a2a328818ea2bdc1409d18ecb3a85825b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/FastIgnoreRuleTest.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java2
2 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/FastIgnoreRuleTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/FastIgnoreRuleTest.java
index a4b799a72e..2c04787e3d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/FastIgnoreRuleTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/FastIgnoreRuleTest.java
@@ -55,6 +55,7 @@ public class FastIgnoreRuleTest {
@Test
public void testSimpleCharClass() {
assertMatched("[a]", "a");
+ assertMatched("][a]", "]a");
assertMatched("[a]", "a/");
assertMatched("[a]", "a/b");
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
index 7452d293d4..2e955d3124 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
@@ -141,7 +141,7 @@ public class Strings {
private static boolean isComplexWildcard(String pattern) {
int idx1 = pattern.indexOf('[');
if (idx1 != -1) {
- int idx2 = pattern.indexOf(']');
+ int idx2 = pattern.indexOf(']', idx1);
if (idx2 > idx1)
return true;
}