}
}
+ @Test
+ public void testFileNameWithLineTerminator() {
+ assertMatched("a?", "a\r");
+ assertMatched("a?", "dir/a\r");
+ assertMatched("*a", "\ra");
+ assertMatched("dir/*a*", "dir/\ra\r");
+ }
+
/**
* Check for a match. If target ends with "/", match will assume that the
* target is meant to be a directory.
assertMatched("x/**/", "x/y/a/");
}
+ @Test
+ public void testFileNameWithLineTerminator() {
+ assertMatched("a?", "a\r");
+ assertMatched("a?", "dir/a\r");
+ assertMatched("a?", "a\r/file");
+ assertMatched("*a", "\ra");
+ assertMatched("dir/*a*", "dir/\ra\r");
+ }
+
private void assertMatched(String pattern, String path) {
boolean match = match(pattern, path);
String result = path + " is " + (match ? "ignored" : "not ignored")
if (in_brackets > 0)
throw new InvalidPatternException("Not closed bracket?", pattern); //$NON-NLS-1$
try {
- return Pattern.compile(sb.toString());
+ return Pattern.compile(sb.toString(), Pattern.DOTALL);
} catch (PatternSyntaxException e) {
throw new InvalidPatternException(
MessageFormat.format(JGitText.get().invalidIgnoreRule,