Signed-off-by: Florian Koeberle <florianskarten@xxxxxx> --- .../src/org/spearce/jgit/treewalk/rules/Rule.java | 61 ++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) create mode 100644 org.spearce.jgit/src/org/spearce/jgit/treewalk/rules/Rule.java diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/rules/Rule.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/rules/Rule.java new file mode 100644 index 0000000..1cc74f5 --- /dev/null +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/rules/Rule.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2008 Florian Köberle + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License, version 2, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + */ +package org.spearce.jgit.treewalk.rules; + +/** + * A Rule defines what to do with a files which match a specified + * {@link FilePattern}. + */ +public class Rule { + private boolean ignoreAtMatch; + + private FilePattern pattern; + + /** + * + * @param ignoreAtMatch + * defines if the rules ignores or accepts at a match. + * @param pattern + * the pattern used to test if a file matches. + */ + Rule(boolean ignoreAtMatch, FilePattern pattern) { + this.ignoreAtMatch = ignoreAtMatch; + this.pattern = pattern; + } + + FilePattern getPattern() { + return pattern; + } + + boolean isIgnoreAtMatch() { + return ignoreAtMatch; + } + + Rule getRuleForSubDirectory(String directoryName) { + final FilePattern subPattern = pattern + .getPatternForSubDirectory(directoryName); + if (subPattern == pattern) { + return this; + } + return new Rule(ignoreAtMatch, subPattern); + } + + boolean isSameForSubDirectories() { + return pattern.isSameForSubDirectories(); + } + +} -- 1.5.4.3 -- 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