Top Description Inners Fields Constructors Methods
org.eclipse.jgit.ignore

public Class IgnoreNode

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.treewalk.WorkingTreeIterator.PerDirectoryIgnoreNode, org.eclipse.jgit.treewalk.WorkingTreeIterator.IgnoreNodeWithParent
Static Imports
java.nio.charset.StandardCharsets.UTF_8

Represents a bundle of ignore rules inherited from a base directory. This class is not thread safe, it maintains state about the last match.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private static final Logger
private final List<FastIgnoreRule>
rules

The rules that have been parsed into this node.

Constructor Summary

AccessConstructor and Description
public
IgnoreNode()

Create an empty ignore node with no rules.

public
IgnoreNode(List<FastIgnoreRule>
list of rules.
rules
)

Create an ignore node with given rules.

Method Summary

Modifier and TypeMethod and Description
private static BufferedReader
public Boolean

Returns:

Boolean.TRUE, if the entry is ignored; Boolean.FALSE, if the entry is forced to be not ignored (negated match); or null, if undetermined
checkIgnored
(String
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 '\').
entryPath
,
boolean
true if the target item is a directory.
isDirectory
)

Determine if an entry path matches an ignore rule.

public List<FastIgnoreRule>

Returns:

list of all ignore rules held by this node
getRules
()

Get list of all ignore rules held by this node

public IgnoreNode.MatchResult

Returns:

status of the path.
isIgnored
(String
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 '\').
entryPath
,
boolean
true if the target item is a directory.
isDirectory
)

Determine if an entry path matches an ignore rule.

public void
parse(InputStream
input stream holding the standard ignore format. The caller is responsible for closing the stream.
in
)

Parse files according to gitignore standards.

public void
parse(String
identifying the source of the stream
sourceName
,
InputStream
input stream holding the standard ignore format. The caller is responsible for closing the stream.
in
)

Parse files according to gitignore standards.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG
rulesback to summary
private final List<FastIgnoreRule> rules

The rules that have been parsed into this node.

Constructor Detail

IgnoreNodeback to summary
public IgnoreNode()

Create an empty ignore node with no rules.

IgnoreNodeback to summary
public IgnoreNode(List<FastIgnoreRule> rules)

Create an ignore node with given rules.

Parameters
rules:List<FastIgnoreRule>

list of rules.

Method Detail

asReaderback to summary
private static BufferedReader asReader(InputStream in)
checkIgnoredback to summary
public Boolean checkIgnored(String entryPath, boolean isDirectory)

Determine if an entry path matches an ignore rule.

Parameters
entryPath:String

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:boolean

true if the target item is a directory.

Returns:Boolean

Boolean.TRUE, if the entry is ignored; Boolean.FALSE, if the entry is forced to be not ignored (negated match); or null, if undetermined

Annotations
@Nullable
Since
4.11
getRulesback to summary
public List<FastIgnoreRule> getRules()

Get list of all ignore rules held by this node

Returns:List<FastIgnoreRule>

list of all ignore rules held by this node

isIgnoredback to summary
public IgnoreNode.MatchResult isIgnored(String entryPath, boolean isDirectory)

Determine if an entry path matches an ignore rule.

Parameters
entryPath:String

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:boolean

true if the target item is a directory.

Returns:IgnoreNode.MatchResult

status of the path.

parseback to summary
public void parse(InputStream in) throws IOException

Parse files according to gitignore standards.

Parameters
in:InputStream

input stream holding the standard ignore format. The caller is responsible for closing the stream.

Exceptions
IOException:
Error thrown when reading an ignore file.
parseback to summary
public void parse(String sourceName, InputStream in) throws IOException

Parse files according to gitignore standards.

Parameters
sourceName:String

identifying the source of the stream

in:InputStream

input stream holding the standard ignore format. The caller is responsible for closing the stream.

Exceptions
IOException:
Error thrown when reading an ignore file.
Since
5.11
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jgit.ignore back to summary

public final Enum IgnoreNode.MatchResult

extends Enum<IgnoreNode.MatchResult>
Class Inheritance

Result from IgnoreNode#isIgnored(String, boolean).

Field Summary

Modifier and TypeField and Description
public static final IgnoreNode.MatchResult
CHECK_PARENT

The ignore status is unknown, check inherited rules.

public static final IgnoreNode.MatchResult
CHECK_PARENT_NEGATE_FIRST_MATCH

The first previous (parent) ignore rule match (if any) should be negated, and then inherited rules applied.

public static final IgnoreNode.MatchResult
IGNORED

The file is ignored due to a rule in this node.

public static final IgnoreNode.MatchResult
NOT_IGNORED

The file is not ignored, due to a rule saying its not ignored.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static IgnoreNode.MatchResult
public static IgnoreNode.MatchResult[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CHECK_PARENTback to summary
public static final IgnoreNode.MatchResult CHECK_PARENT

The ignore status is unknown, check inherited rules.

CHECK_PARENT_NEGATE_FIRST_MATCHback to summary
public static final IgnoreNode.MatchResult CHECK_PARENT_NEGATE_FIRST_MATCH

The first previous (parent) ignore rule match (if any) should be negated, and then inherited rules applied.

Since
3.6
IGNOREDback to summary
public static final IgnoreNode.MatchResult IGNORED

The file is ignored due to a rule in this node.

NOT_IGNOREDback to summary
public static final IgnoreNode.MatchResult NOT_IGNORED

The file is not ignored, due to a rule saying its not ignored.

Constructor Detail

MatchResultback to summary
private MatchResult()

Method Detail

valueOfback to summary
public static IgnoreNode.MatchResult valueOf(String name)
valuesback to summary
public static IgnoreNode.MatchResult[] values()