public class IndexDiffFilter extends TreeFilter
TreeFilter.ANY_DIFF
which should
be used when among the walked trees there is a DirCacheIterator
and a
WorkingTreeIterator
. Please see the documentation of
TreeFilter.ANY_DIFF
for a basic description of the semantics.
This filter tries to avoid computing content ids of the files in the
working-tree. In contrast to TreeFilter.ANY_DIFF
this filter takes
care to first compare the entry from the DirCacheIterator
with the
entries from all other iterators besides the WorkingTreeIterator
.
Since all those entries have fast access to content ids that is very fast. If
a difference is detected in this step this filter decides to include that
path before even looking at the working-tree entry.
If no difference is found then we have to compare index and working-tree as
the last step. By making use of
WorkingTreeIterator.isModified(org.eclipse.jgit.dircache.DirCacheEntry, boolean, ObjectReader)
we can avoid the computation of the content id if the file is not dirty.
Instances of this filter should not be used for multiple TreeWalk
s.
Always construct a new instance of this filter for each TreeWalk.
ALL, ANY_DIFF
Constructor and Description |
---|
IndexDiffFilter(int dirCacheIndex,
int workingTreeIndex)
Creates a new instance of this filter.
|
IndexDiffFilter(int dirCacheIndex,
int workingTreeIndex,
boolean honorIgnores)
Creates a new instance of this filter.
|
Modifier and Type | Method and Description |
---|---|
TreeFilter |
clone()
Clone this tree filter, including its parameters.
|
Set<String> |
getIgnoredPaths()
The method returns the list of ignored files and folders.
|
List<String> |
getUntrackedFolders() |
boolean |
include(TreeWalk tw)
Determine if the current entry is interesting to report.
|
boolean |
shouldBeRecursive()
Does this tree filter require a recursive walk to match everything?
|
String |
toString() |
negate
public IndexDiffFilter(int dirCacheIndex, int workingTreeIndex)
dirCacheIndex
- the index of the DirCacheIterator
in the associated
treewalkworkingTreeIndex
- the index of the WorkingTreeIterator
in the associated
treewalkpublic IndexDiffFilter(int dirCacheIndex, int workingTreeIndex, boolean honorIgnores)
dirCacheIndex
- the index of the DirCacheIterator
in the associated
treewalkworkingTreeIndex
- the index of the WorkingTreeIterator
in the associated
treewalkhonorIgnores
- true if the filter should skip working tree files that are
declared as ignored by the standard exclude mechanisms..public boolean include(TreeWalk tw) throws MissingObjectException, IncorrectObjectTypeException, IOException
TreeFilter
This method is consulted for subtree entries even if
TreeWalk.isRecursive()
is enabled. The consultation allows the
filter to bypass subtree recursion on a case-by-case basis, even when
recursion is enabled at the application level.
include
in class TreeFilter
tw
- the walker the filter needs to examine.MissingObjectException
- an object the filter needs to consult to determine its answer
does not exist in the Git repository the walker is operating
on. Filtering this current walker entry is impossible without
the object.IncorrectObjectTypeException
- an object the filter needed to consult was not of the
expected object type. This usually indicates a corrupt
repository, as an object link is referencing the wrong type.IOException
- a loose object or pack file could not be read to obtain data
necessary for the filter to make its decision.public boolean shouldBeRecursive()
TreeFilter
If this tree filter is matching on full entry path names and its pattern is looking for a '/' then the filter would require a recursive TreeWalk to accurately make its decisions. The walker is not required to enable recursive behavior for any particular filter, this is only a hint.
shouldBeRecursive
in class TreeFilter
public TreeFilter clone()
TreeFilter
This is a deep clone. If this filter embeds objects or other filters it must also clone those, to ensure the instances do not share mutable data.
clone
in class TreeFilter
public String toString()
toString
in class TreeFilter
public Set<String> getIgnoredPaths()
public List<String> getUntrackedFolders()
TreeWalk.setPostOrderTraversal(boolean)
) then an
empty list will be returned.Copyright © 2016 Eclipse JGit Project. All rights reserved.