Package org.eclipse.jgit.transport
Class FilterSpec
java.lang.Object
org.eclipse.jgit.transport.FilterSpec
Represents either a filter specified in a protocol "filter" line, or a
placeholder to indicate no filtering.
- Since:
- 5.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
Immutable bit-set representation of a set of Git object types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
static final FilterSpec
A placeholder that indicates no filtering.private final long
private final FilterSpec.ObjectTypes
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
FilterSpec
(FilterSpec.ObjectTypes types, long blobLimit, long treeDepthLimit) -
Method Summary
Modifier and TypeMethodDescriptionboolean
allowsType
(int type) static FilterSpec
fromFilterLine
(String filterLine) Process the content of "filter" line from the protocol.long
long
boolean
isNoOp()
(package private) static FilterSpec
withBlobLimit
(long blobLimit) (package private) static FilterSpec
(package private) static FilterSpec
withTreeDepthLimit
(long treeDepthLimit)
-
Field Details
-
types
-
blobLimit
private final long blobLimit -
treeDepthLimit
private final long treeDepthLimit -
NO_FILTER
A placeholder that indicates no filtering.
-
-
Constructor Details
-
FilterSpec
-
-
Method Details
-
fromFilterLine
Process the content of "filter" line from the protocol. It has a shape like:- "blob:none"
- "blob:limit=N", with N >= 0
- "tree:DEPTH", with DEPTH >= 0
- Parameters:
filterLine
- the content of the "filter" line in the protocol- Returns:
- a FilterSpec representing the given filter
- Throws:
PackProtocolException
- invalid filter because due to unrecognized format or negative/non-numeric filter.
-
withObjectTypes
- Parameters:
types
- set of permitted object types, for use in "blob:none" and "object:none" filters- Returns:
- a filter spec which restricts to objects of the specified types
-
withBlobLimit
- Parameters:
blobLimit
- the blob limit in a "blob:[limit]" filter line- Returns:
- a filter spec which filters blobs above a certain size
-
withTreeDepthLimit
- Parameters:
treeDepthLimit
- the tree depth limit in a "tree:[depth]" filter line- Returns:
- a filter spec which filters blobs and trees beyond a certain tree depth
-
allowsType
public boolean allowsType(int type) - Parameters:
type
- a Git object type, such asConstants.OBJ_BLOB
- Returns:
- whether this filter allows objects of the specified type
- Since:
- 5.9
-
getBlobLimit
public long getBlobLimit()- Returns:
- -1 if this filter does not filter blobs based on size, or a non-negative integer representing the max size of blobs to allow
-
getTreeDepthLimit
public long getTreeDepthLimit()- Returns:
- -1 if this filter does not filter blobs and trees based on depth, or a non-negative integer representing the max tree depth of blobs and trees to fetch
-
isNoOp
public boolean isNoOp()- Returns:
- true if this filter doesn't filter out anything
-
filterLine
- Returns:
- the filter line which describes this spec, e.g. "filter blob:limit=42"
-