Selaa lähdekoodia

[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>
tags/v4.1.0.201509280440-r
Andrey Loskutov 8 vuotta sitten
vanhempi
commit
4b7daecf4a

+ 1
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/FastIgnoreRuleTest.java Näytä tiedosto

@Test @Test
public void testSimpleCharClass() { public void testSimpleCharClass() {
assertMatched("[a]", "a"); assertMatched("[a]", "a");
assertMatched("][a]", "]a");
assertMatched("[a]", "a/"); assertMatched("[a]", "a/");
assertMatched("[a]", "a/b"); assertMatched("[a]", "a/b");



+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java Näytä tiedosto

private static boolean isComplexWildcard(String pattern) { private static boolean isComplexWildcard(String pattern) {
int idx1 = pattern.indexOf('['); int idx1 = pattern.indexOf('[');
if (idx1 != -1) { if (idx1 != -1) {
int idx2 = pattern.indexOf(']');
int idx2 = pattern.indexOf(']', idx1);
if (idx2 > idx1) if (idx2 > idx1)
return true; return true;
} }

Loading…
Peruuta
Tallenna