public class FileTreeIterator extends WorkingTreeIterator
This iterator uses the standard java.io
package to read the
specified working directory as part of a
TreeWalk
.
Modifier and Type | Class and Description |
---|---|
static class |
FileTreeIterator.DefaultFileModeStrategy
A default implementation of a FileModeStrategy; defaults to treating
nested .git directories as gitlinks, etc.
|
static class |
FileTreeIterator.FileEntry
Wrapper for a standard Java IO file
|
static interface |
FileTreeIterator.FileModeStrategy
An interface representing the methods used to determine the FileMode for
a FileEntry.
|
static class |
FileTreeIterator.NoGitlinksStrategy
A FileModeStrategy that implements native git's DIR_NO_GITLINKS
behavior.
|
WorkingTreeIterator.Entry, WorkingTreeIterator.MetadataDiff
Modifier and Type | Field and Description |
---|---|
protected File |
directory
the starting directory of this Iterator.
|
protected FileTreeIterator.FileModeStrategy |
fileModeStrategy
the strategy used to compute the FileMode for a FileEntry.
|
protected FS |
fs
the file system abstraction which will be necessary to perform certain
file system operations.
|
EOF, repository
attributesNode, DEFAULT_PATH_SIZE, mode, parent, path, pathLen, pathOffset, zeroid
Modifier | Constructor and Description |
---|---|
|
FileTreeIterator(File root,
FS fs,
WorkingTreeOptions options)
Create a new iterator to traverse the given directory and its children.
|
|
FileTreeIterator(File root,
FS fs,
WorkingTreeOptions options,
FileTreeIterator.FileModeStrategy fileModeStrategy)
Create a new iterator to traverse the given directory and its children.
|
protected |
FileTreeIterator(FileTreeIterator p,
File root,
FS fs)
Create a new iterator to traverse a subdirectory.
|
|
FileTreeIterator(Repository repo)
Create a new iterator to traverse the work tree and its children.
|
|
FileTreeIterator(Repository repo,
FileTreeIterator.FileModeStrategy fileModeStrategy)
Create a new iterator to traverse the work tree and its children.
|
protected |
FileTreeIterator(WorkingTreeIterator p,
File root,
FS fs,
FileTreeIterator.FileModeStrategy fileModeStrategy)
Create a new iterator to traverse a subdirectory, given the specified
FileModeStrategy.
|
Modifier and Type | Method and Description |
---|---|
AbstractTreeIterator |
createSubtreeIterator(ObjectReader reader)
Create a new iterator for the current entry's subtree.
|
protected AbstractTreeIterator |
enterSubtree()
Create a new iterator for the current entry's subtree.
|
File |
getDirectory()
Getter for the field
directory . |
File |
getEntryFile()
Get the location of the working file.
|
protected byte[] |
idSubmodule(WorkingTreeIterator.Entry e)
Get submodule id for given entry.
|
protected String |
readSymlinkTarget(WorkingTreeIterator.Entry entry)
Reads the target of a symlink as a string.
|
back, compareMetadata, current, eof, first, getCleanFilterCommand, getDirCacheIterator, getEntryAttributesNode, getEntryContentLength, getEntryLastModified, getEntryLastModifiedInstant, getEntryLength, getEolStreamType, getIndexFileMode, getOptions, hasId, idBuffer, idOffset, idSubmodule, init, initRootIterator, isEntryIgnored, isEntryIgnored, isModeDifferent, isModified, isWorkTree, next, openEntryStream, reset, setDirCacheIterator, setWalkIgnoredDirectories, walksIgnoredDirectories
createEmptyTreeIterator, createSubtreeIterator, ensurePathCapacity, findFile, findFile, getEntryFileMode, getEntryObjectId, getEntryObjectId, getEntryPathBuffer, getEntryPathHashCode, getEntryPathLength, getEntryPathString, getEntryRawMode, getName, getNameLength, getNameOffset, growPath, idEqual, needsStopWalk, pathCompare, pathCompare, skip, stopWalk, toString
protected final File directory
protected final FS fs
protected final FileTreeIterator.FileModeStrategy fileModeStrategy
public FileTreeIterator(Repository repo)
repo
- the repository whose working tree will be scanned.public FileTreeIterator(Repository repo, FileTreeIterator.FileModeStrategy fileModeStrategy)
repo
- the repository whose working tree will be scanned.fileModeStrategy
- the strategy to use to determine the FileMode for a FileEntry;
controls gitlinks etc.public FileTreeIterator(File root, FS fs, WorkingTreeOptions options)
root
- the starting directory. This directory should correspond to
the root of the repository.fs
- the file system abstraction which will be necessary to perform
certain file system operations.options
- working tree options to be usedpublic FileTreeIterator(File root, FS fs, WorkingTreeOptions options, FileTreeIterator.FileModeStrategy fileModeStrategy)
root
- the starting directory. This directory should correspond to
the root of the repository.fs
- the file system abstraction which will be necessary to perform
certain file system operations.options
- working tree options to be usedfileModeStrategy
- the strategy to use to determine the FileMode for a FileEntry;
controls gitlinks etc.protected FileTreeIterator(FileTreeIterator p, File root, FS fs)
p
- the parent iterator we were created from.root
- the subdirectory. This should be a directory contained within
the parent directory.fs
- the file system abstraction which will be necessary to perform
certain file system operations.protected FileTreeIterator(WorkingTreeIterator p, File root, FS fs, FileTreeIterator.FileModeStrategy fileModeStrategy)
p
- the parent iterator we were created from.root
- the subdirectory. This should be a directory contained within
the parent directoryfs
- the file system abstraction which will be necessary to perform
certain file system operations.fileModeStrategy
- the strategy to use to determine the FileMode for a given
FileEntry.public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException
The parent reference of the iterator must be this
,
otherwise the caller would not be able to exit out of the subtree
iterator correctly and return to continue walking this
.
createSubtreeIterator
in class AbstractTreeIterator
reader
- reader to load the tree data from.IncorrectObjectTypeException
- the current entry is not actually a tree and cannot be parsed
as though it were a tree.IOException
- a loose object or pack file could not be read.protected AbstractTreeIterator enterSubtree()
The parent reference of the iterator must be this
, otherwise
the caller would not be able to exit out of the subtree iterator
correctly and return to continue walking this
.
public File getDirectory()
Getter for the field directory
.
public File getEntryFile()
new
File(getDirectory(), getEntryPath())
but may be faster by
reusing an internal File instance.protected byte[] idSubmodule(WorkingTreeIterator.Entry e)
idSubmodule
in class WorkingTreeIterator
e
- a WorkingTreeIterator.Entry
object.protected String readSymlinkTarget(WorkingTreeIterator.Entry entry) throws IOException
readSymlinkTarget
in class WorkingTreeIterator
entry
- to readIOException
- if the entry cannot be read or does not denote a symlinkCopyright © 2020 Eclipse JGit Project. All rights reserved.