Hi This patch set contains a new fnmatch implementation. I dropped the idea of an regex based Matcher and implemented my own one. The matcher matches character for character and can produce another matcher, which always starts at the position where it's parent was at creation time. If you need to match: very/long/path/a.txt very/long/path/b.txt very/long/path/c.txt Then you can match "very/long/path" in matcher p and then "a.txt", "b.txt" and "c.txt" in another matcher c. That works for any input pattern which are currently supported: * characters * the wildcards ? and * * the wildcards ? and * with one character which should not appear like '/' * simple groups like [ab] * ranges in groups like [a-c] * inversed groups like [!ab] Unsupported are colon expressions like ":alpha:". I didn't expect git-add to support it, but as I just noticed git does. Also backslashes expressions like "\d" for digits are evaluated as the characters \ and d. Looks like git does the same for backslashes. In "git-add" patterns \ characters get replaced by / characters, as windows users might want to type a\b.txt instead of a/b.txt. All implementations of FilePattern are now based on this matcher. I combined as suggested the TreeFilePattern and the ComplexFilePattern into one class named FilePathPattern. I furthermore renamed the GlobalFilePattern into FileNamePattern. "git add" patterns are now handled very similar to git, except that a/\*/b.txt is also a valid pattern. It would match any path that starts with "a/" and ends with "/b.txt" independent of the number of slahes between. .../org/spearce/jgit/lib/FileNameMatcherTest.java | 311 +++++++++++++ .../jgit/treewalk/LightFileTreeIteratorTest.java | 114 +++++ .../treewalk/rules/AddCommandIterationTest.java | 321 +++++++++++++ .../treewalk/rules/OverallIgnoreRulesTest.java | 375 +++++++++++++++ .../jgit/errors/InvalidPatternException.java | 44 ++ .../jgit/errors/NoGitRepositoryFoundException.java | 28 ++ .../errors/PathNotInProjectDirectoryException.java | 25 + .../src/org/spearce/jgit/lib/Constants.java | 30 +- .../src/org/spearce/jgit/lib/FileNameMatcher.java | 376 +++++++++++++++ .../src/org/spearce/jgit/lib/Repository.java | 482 +++++++++++++------- .../src/org/spearce/jgit/lib/WorkTree.java | 67 +++ .../jgit/treewalk/LightFileTreeIterable.java | 59 +++ .../jgit/treewalk/LightFileTreeIterator.java | 112 +++++ .../jgit/treewalk/rules/AddRuleListFactory.java | 75 +++ .../jgit/treewalk/rules/AddRulesFactory.java | 90 ++++ .../jgit/treewalk/rules/FileNamePattern.java | 58 +++ .../jgit/treewalk/rules/FilePathPattern.java | 76 +++ .../spearce/jgit/treewalk/rules/FilePattern.java | 107 +++++ .../jgit/treewalk/rules/IgnoreRuleListFactory.java | 94 ++++ .../src/org/spearce/jgit/treewalk/rules/Rule.java | 61 +++ .../treewalk/rules/RuleListToObjectConverter.java | 130 ++++++ .../src/org/spearce/jgit/treewalk/rules/Rules.java | 99 ++++ .../jgit/treewalk/rules/RulesImplementation.java | 73 +++ Best regards, Florian Koeberle -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html