org.eclipse.jgit.dircache.DirCache as part of a
TreeWalk.
This is an iterator to adapt a loaded DirCache instance (such as
read from an existing .git/index file) to the tree structure
used by a TreeWalk, making it possible for applications to walk
over any combination of tree objects already in the object database, index
files, or working directories.
org.eclipse.jgit.treewalk.TreeWalk
| Modifier and Type | Class and Description |
|---|---|
| private static class | DirCacheIterator.
|
| Modifier and Type | Field and Description |
|---|---|
| protected final DirCache | cache
The cache this iterator was created to walk. |
| protected DirCacheEntry | currentEntry
The current file entry from |
| protected DirCacheTree | currentSubtree
The subtree containing |
| private static final byte[] | DOT_GIT_ATTRIBUTES_BYTES
Byte array holding ".gitattributes" string |
| private int | nextSubtreePos
Next subtree to consider within |
| protected int | |
| private final byte[] | subtreeId
Special buffer to hold the ObjectId of |
| private final DirCacheTree | tree
The tree this iterator is walking. |
| private final int | treeEnd
Last position in this tree. |
| private final int | treeStart
First position in this tree. |
| Access | Constructor and Description |
|---|---|
| public | DirCacheIterator(DirCache
the cache to walk. It must be already loaded into memory. dc)Create a new iterator for an already loaded DirCache instance. |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | back(int
number of entries to move the iterator by. Must be a positive,
non-zero integer. delta)Implements abstract org. Move to prior entry, populating this iterator with the entry data. |
| public EmptyTreeIterator | createEmptyTreeIterator()
Overrides org. Create a new iterator as though the current entry were a subtree. |
| public AbstractTreeIterator | createSubtreeIterator(ObjectReader
reader to load the tree data from. reader)Implements abstract org. Create a new iterator for the current entry's subtree. |
| public boolean | eof()
Implements abstract org. Is this tree iterator at its EOF point (no more entries)? |
| public boolean | first()
Implements abstract org. Is this tree iterator positioned on its first entry? |
| public DirCacheEntry | Returns: the current cache entry, if this iterator is positioned on a non-tree.Get the DirCacheEntry for the current file. |
| public AttributesNode | Returns: org. for the
current entry.org. used to parse the
.gitattributes entry.Retrieves the |
| public boolean | hasId()
Implements abstract org. Whether the entry has a valid ObjectId. |
| public byte[] | idBuffer()
Implements abstract org. Get the byte array buffer object IDs must be copied out of. |
| public int | idOffset()
Implements abstract org. Get the position within |
| public void | next(int
number of entries to move the iterator by. Must be a positive,
non-zero integer. delta)Implements abstract org. Move to next entry, populating this iterator with the entry data. |
| private void | |
| private void | |
| public void | reset()
Overrides org. Position this iterator on the first entry. |
| cache | back to summary |
|---|---|
| protected final DirCache cache The cache this iterator was created to walk. | |
| currentEntry | back to summary |
|---|---|
| protected DirCacheEntry currentEntry The current file entry from | |
| currentSubtree | back to summary |
|---|---|
| protected DirCacheTree currentSubtree The subtree containing | |
| DOT_GIT_ATTRIBUTES_BYTES | back to summary |
|---|---|
| private static final byte[] DOT_GIT_ATTRIBUTES_BYTES Byte array holding ".gitattributes" string | |
| nextSubtreePos | back to summary |
|---|---|
| private int nextSubtreePos Next subtree to consider within | |
| ptr | back to summary |
|---|---|
| protected int ptr Index of entry within | |
| subtreeId | back to summary |
|---|---|
| private final byte[] subtreeId Special buffer to hold the ObjectId of | |
| tree | back to summary |
|---|---|
| private final DirCacheTree tree The tree this iterator is walking. | |
| treeEnd | back to summary |
|---|---|
| private final int treeEnd Last position in this tree. | |
| treeStart | back to summary |
|---|---|
| private final int treeStart First position in this tree. | |
| DirCacheIterator | back to summary |
|---|---|
| public DirCacheIterator(DirCache dc) Create a new iterator for an already loaded DirCache instance. The iterator implementation may copy part of the cache's data during construction, so the cache must be read in prior to creating the iterator.
| |
| DirCacheIterator | back to summary |
|---|---|
| pack-priv DirCacheIterator(DirCacheIterator p, DirCacheTree dct) | |
| back | back to summary |
|---|---|
| public void back(int delta) Implements abstract org. Doc from org. Move to prior entry, populating this iterator with the entry data. The delta indicates how many moves backward should occur.The most common delta is 1 to move to the prior entry. Implementations must populate the following members:
idBuffer() and idOffset()
when demanded.
| |
| createEmptyTreeIterator | back to summary |
|---|---|
| public EmptyTreeIterator createEmptyTreeIterator() Overrides org. Doc from org. Create a new iterator as though the current entry were a subtree.
| |
| createSubtreeIterator | back to summary |
|---|---|
| public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException Implements abstract org. Doc from org. Create a new iterator for the current entry's subtree.
The parent reference of the iterator must be
| |
| eof | back to summary |
|---|---|
| public boolean eof() Implements abstract org. Doc from org. Is this tree iterator at its EOF point (no more entries)? An iterator is at EOF if there is no current entry.
| |
| first | back to summary |
|---|---|
| public boolean first() Implements abstract org. Doc from org. Is this tree iterator positioned on its first entry?
An iterator is positioned on the first entry if
An empty iterator (one with no entries) will be
| |
| getDirCacheEntry | back to summary |
|---|---|
| public DirCacheEntry getDirCacheEntry() Get the DirCacheEntry for the current file.
| |
| getEntryAttributesNode | back to summary |
|---|---|
| public AttributesNode getEntryAttributesNode(ObjectReader reader) throws IOException Retrieves the
| |
| hasId | back to summary |
|---|---|
| public boolean hasId() Implements abstract org. Doc from org. Whether the entry has a valid ObjectId.
| |
| idBuffer | back to summary |
|---|---|
| public byte[] idBuffer() Implements abstract org. Doc from org. Get the byte array buffer object IDs must be copied out of. The id buffer contains the bytes necessary to construct an ObjectId for the current entry of this iterator. The buffer can be the same buffer for all entries, or it can be a unique buffer per-entry. Implementations are encouraged to expose their private buffer whenever possible to reduce garbage generation and copying costs.
| |
| idOffset | back to summary |
|---|---|
| public int idOffset() Implements abstract org. Doc from org. Get the position within
| |
| next | back to summary |
|---|---|
| public void next(int delta) Implements abstract org. Doc from org. Move to next entry, populating this iterator with the entry data. The delta indicates how many moves forward should occur. The most common delta is 1 to move to the next entry. Implementations must populate the following members:
idBuffer() and idOffset()
when demanded.
| |
| parseEntry | back to summary |
|---|---|
| private void parseEntry() | |
| parseEntry | back to summary |
|---|---|
| private void parseEntry(boolean forward) | |
| reset | back to summary |
|---|---|
| public void reset() Overrides org. Doc from org. Position this iterator on the first entry.
The default implementation of this method uses
| |
AttributesNode implementation that provides lazy loading
facilities.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv AttributesNode |
| objectId | back to summary |
|---|---|
| pack-priv final ObjectId objectId | |
| LazyLoadingAttributesNode | back to summary |
|---|---|
| pack-priv LazyLoadingAttributesNode(ObjectId objectId) | |
| load | back to summary |
|---|---|
| pack-priv AttributesNode load(ObjectReader reader) throws IOException | |