git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH v3 0/23] Implementation of a file tree iteration using ignore rules.
@ 2008-05-23 20:34 Florian Koeberle
  2008-05-23 20:34 ` [JGIT PATCH v3 01/23] Added the class InvalidPatternException Florian Koeberle
                   ` (25 more replies)
  0 siblings, 26 replies; 41+ messages in thread
From: Florian Koeberle @ 2008-05-23 20:34 UTC (permalink / raw)
  To: git


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

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2008-06-09 17:12 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23 20:34 [JGIT PATCH v3 0/23] Implementation of a file tree iteration using ignore rules Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 01/23] Added the class InvalidPatternException Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 02/23] Added the class FileNameMatcher and a test class for it Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 03/23] Added the interface FilePattern Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 04/23] Added the class Rule Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 05/23] Added the iterface Rules Florian Koeberle
2008-06-06  0:22   ` Robin Rosenberg
2008-05-23 20:34 ` [JGIT PATCH v3 06/23] Added the class FileNamePattern Florian Koeberle
2008-06-06  0:22   ` Robin Rosenberg
2008-05-23 20:34 ` [JGIT PATCH v3 07/23] Added the class FilePathPattern Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 08/23] Added the class IgnoreRuleListFactory Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 09/23] Added a Rules interface implementation and a factory for it Florian Koeberle
2008-06-06  0:23   ` Robin Rosenberg
2008-05-23 20:34 ` [JGIT PATCH v3 10/23] Added test class OverallIgnoreRulestest Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 11/23] Added the class PathNotInProjectDirectoryException Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 12/23] Added the class AddRuleListFactory Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 13/23] Formatted Constants class Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 14/23] Added constant REPOSITORY_DIRECTORY_NAME to " Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 15/23] Added class AddRulesFactory Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 16/23] Added the class LightFileTreeIterator and a test for it Florian Koeberle
2008-05-31 10:03   ` [JGIT PATCH v3.1 " Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 17/23] Added class LightFileTreeIterable Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 18/23] Added path related constants to the Constants class Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 19/23] Added WorkTree class which can be constructed over Repository Florian Koeberle
2008-06-06  0:23   ` Robin Rosenberg
2008-05-23 20:34 ` [JGIT PATCH v3 20/23] Added the class NoGitRepositoryFoundException Florian Koeberle
2008-06-06  0:23   ` Robin Rosenberg
2008-06-08 16:14     ` Florian Köberle
2008-06-08 21:05       ` Robin Rosenberg
2008-05-23 20:34 ` [JGIT PATCH v3 21/23] Formatted Repository class Florian Koeberle
2008-06-06  0:23   ` Robin Rosenberg
2008-05-23 20:34 ` [JGIT PATCH v3 22/23] Added findWorkTree method to " Florian Koeberle
2008-05-23 20:34 ` [JGIT PATCH v3 23/23] Added the test class AddCommandIterationTest Florian Koeberle
2008-05-31 10:09   ` [JGIT PATCH v3.1 " Florian Koeberle
2008-06-06  0:23   ` [JGIT PATCH v3 " Robin Rosenberg
2008-05-31 10:17 ` [JGIT PATCH v3 0/23] Implementation of a file tree iteration using ignore rules Florian Köberle
2008-06-06  0:22 ` Robin Rosenberg
2008-06-08 16:37   ` Florian Köberle
2008-06-08 21:28     ` Robin Rosenberg
2008-06-09 17:11       ` Florian Köberle
2008-06-07  8:43 ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).