Package org.eclipse.jgit.ignore
Class FastIgnoreRule
- java.lang.Object
-
- org.eclipse.jgit.ignore.FastIgnoreRule
-
public class FastIgnoreRule extends java.lang.Object
"Fast" (compared with IgnoreRule) git ignore rule implementation supporting also double star**
pattern.
This class is immutable and thread safe.
- Since:
- 3.6
-
-
Field Summary
Fields Modifier and Type Field Description static char
PATH_SEPARATOR
Character used as default path separator for ignore entries
-
Constructor Summary
Constructors Constructor Description FastIgnoreRule(java.lang.String pattern)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
dirOnly()
boolean
equals(java.lang.Object obj)
boolean
getNameOnly()
boolean
getNegation()
Indicates whether the rule is non-negation or negation.boolean
getResult()
Indicates whether the rule is non-negation or negation.int
hashCode()
boolean
isMatch(java.lang.String path, boolean directory)
Returns true if a match was made.java.lang.String
toString()
-
-
-
Field Detail
-
PATH_SEPARATOR
public static final char PATH_SEPARATOR
Character used as default path separator for ignore entries- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FastIgnoreRule
public FastIgnoreRule(java.lang.String pattern)
- Parameters:
pattern
- ignore pattern as described in git manual. If pattern is invalid or is not a pattern (comment), this rule doesn't match anything.
-
-
Method Detail
-
isMatch
public boolean isMatch(java.lang.String path, boolean directory)
Returns true if a match was made.
This function does NOT return the actual ignore status of the target! Please consultgetResult()
for the negation status. The actual ignore status may be true or false depending on whether this rule is an ignore rule or a negation rule.- Parameters:
path
- Name pattern of the file, relative to the base directory of this ruledirectory
- Whether the target file is a directory or not- Returns:
- True if a match was made. This does not necessarily mean that the
target is ignored. Call
getResult()
for the result.
-
getNameOnly
public boolean getNameOnly()
- Returns:
- True if the pattern is just a file name and not a path
-
dirOnly
public boolean dirOnly()
- Returns:
- True if the pattern should match directories only
-
getNegation
public boolean getNegation()
Indicates whether the rule is non-negation or negation.- Returns:
- True if the pattern had a "!" in front of it
-
getResult
public boolean getResult()
Indicates whether the rule is non-negation or negation.- Returns:
- True if the target is to be ignored, false otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-