aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/ignore
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/ignore')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java37
1 files changed, 22 insertions, 15 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
index 2303ffd6d6..16a36baf08 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
@@ -98,24 +98,31 @@ public class FastIgnoreRule {
if (pattern.charAt(0) == '#') {
this.matcher = NO_MATCH;
dirOnly = false;
- } else {
- dirOnly = pattern.charAt(pattern.length() - 1) == PATH_SEPARATOR;
- if (dirOnly) {
- pattern = stripTrailing(pattern, PATH_SEPARATOR);
- if (pattern.length() == 0) {
- this.matcher = NO_MATCH;
- return;
- }
+ return;
+ }
+ if (pattern.charAt(0) == '\\' && pattern.length() > 1) {
+ char next = pattern.charAt(1);
+ if (next == '!' || next == '#') {
+ // remove backslash escaping first special characters
+ pattern = pattern.substring(1);
}
- IMatcher m;
- try {
- m = PathMatcher.createPathMatcher(pattern,
- Character.valueOf(PATH_SEPARATOR), dirOnly);
- } catch (InvalidPatternException e) {
- m = NO_MATCH;
+ }
+ dirOnly = pattern.charAt(pattern.length() - 1) == PATH_SEPARATOR;
+ if (dirOnly) {
+ pattern = stripTrailing(pattern, PATH_SEPARATOR);
+ if (pattern.length() == 0) {
+ this.matcher = NO_MATCH;
+ return;
}
- this.matcher = m;
}
+ IMatcher m;
+ try {
+ m = PathMatcher.createPathMatcher(pattern,
+ Character.valueOf(PATH_SEPARATOR), dirOnly);
+ } catch (InvalidPatternException e) {
+ m = NO_MATCH;
+ }
+ this.matcher = m;
}
/**