Package org.eclipse.jgit.ignore
Class IgnoreNode
- java.lang.Object
-
- org.eclipse.jgit.ignore.IgnoreNode
-
public class IgnoreNode extends java.lang.ObjectRepresents a bundle of ignore rules inherited from a base directory. This class is not thread safe, it maintains state about the last match.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIgnoreNode.MatchResultResult fromisIgnored(String, boolean).
-
Constructor Summary
Constructors Constructor Description IgnoreNode()Create an empty ignore node with no rules.IgnoreNode(java.util.List<FastIgnoreRule> rules)Create an ignore node with given rules.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<FastIgnoreRule>getRules()IgnoreNode.MatchResultisIgnored(java.lang.String entryPath, boolean isDirectory)Determine if an entry path matches an ignore rule.IgnoreNode.MatchResultisIgnored(java.lang.String entryPath, boolean isDirectory, boolean negateFirstMatch)Determine if an entry path matches an ignore rule.voidparse(java.io.InputStream in)Parse files according to gitignore standards.java.lang.StringtoString()
-
-
-
Constructor Detail
-
IgnoreNode
public IgnoreNode()
Create an empty ignore node with no rules.
-
IgnoreNode
public IgnoreNode(java.util.List<FastIgnoreRule> rules)
Create an ignore node with given rules.- Parameters:
rules- list of rules.
-
-
Method Detail
-
parse
public void parse(java.io.InputStream in) throws java.io.IOExceptionParse files according to gitignore standards.- Parameters:
in- input stream holding the standard ignore format. The caller is responsible for closing the stream.- Throws:
java.io.IOException- Error thrown when reading an ignore file.
-
getRules
public java.util.List<FastIgnoreRule> getRules()
- Returns:
- list of all ignore rules held by this node.
-
isIgnored
public IgnoreNode.MatchResult isIgnored(java.lang.String entryPath, boolean isDirectory)
Determine if an entry path matches an ignore rule.- Parameters:
entryPath- the path to test. The path must be relative to this ignore node's own repository path, and in repository path format (uses '/' and not '\').isDirectory- true if the target item is a directory.- Returns:
- status of the path.
-
isIgnored
public IgnoreNode.MatchResult isIgnored(java.lang.String entryPath, boolean isDirectory, boolean negateFirstMatch)
Determine if an entry path matches an ignore rule.- Parameters:
entryPath- the path to test. The path must be relative to this ignore node's own repository path, and in repository path format (uses '/' and not '\').isDirectory- true if the target item is a directory.negateFirstMatch- true if the first match should be negated- Returns:
- status of the path.
- Since:
- 3.6
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-