Package org.eclipse.jgit.attributes
Class AttributesRule
java.lang.Object
org.eclipse.jgit.attributes.AttributesRule
A single attributes rule corresponding to one line in a .gitattributes file.
Inspiration from:
FastIgnoreRule- Since:
- 3.7
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAttributesRule(String pattern, String attributes) Create a new attribute rule with the given pattern. -
Method Summary
Modifier and TypeMethodDescriptionReturn the attributes.Get the patternbooleanWhether to match directories onlybooleanReturnstrueif a match was made.booleanWhether the pattern is only a file name and not a pathparseAttributes(String attributesLine) toString()
-
Field Details
-
ATTRIBUTES_SPLIT_REGEX
regular expression for splitting attributes - space, tab and \r (the C implementation oddly enough allows \r between attributes)- See Also:
-
pattern
-
attributes
-
nameOnly
private final boolean nameOnly -
dirOnly
private final boolean dirOnly -
matcher
-
-
Constructor Details
-
AttributesRule
Create a new attribute rule with the given pattern. Assumes that the pattern is already trimmed.- Parameters:
pattern- Base pattern for the attributes rule. This pattern will be parsed to generate rule parameters. It can not benull.attributes- the rule attributes. This string will be parsed to read the attributes.
-
-
Method Details
-
parseAttributes
-
isDirOnly
public boolean isDirOnly()Whether to match directories only- Returns:
trueif the pattern should match directories only- Since:
- 4.3
-
getAttributes
Return the attributes.- Returns:
- an unmodifiable list of attributes (never returns
null)
-
isNameOnly
public boolean isNameOnly()Whether the pattern is only a file name and not a path- Returns:
trueif the pattern is just a file name and not a path
-
getPattern
Get the pattern- Returns:
- The blob pattern to be used as a matcher (never returns
null)
-
isMatch
Returnstrueif a match was made.- Parameters:
relativeTarget- Name pattern of the file, relative to the base directory of this ruleisDirectory- Whether the target file is a directory or not- Returns:
- True if a match was made.
-
toString
-