aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2012-12-01 17:51:09 (EST)
committerChris Aniszczyk2012-12-03 12:26:39 (EST)
commit4213a91c97c68d7a4ee1450210f55ebeab401654 (patch)
tree94a0dfe4365209f894db995294450edba71c4edd
parent55e8f2a433589a4c4969546493173a05ec4830dd (diff)
downloadjgit-4213a91c97c68d7a4ee1450210f55ebeab401654.zip
jgit-4213a91c97c68d7a4ee1450210f55ebeab401654.tar.gz
jgit-4213a91c97c68d7a4ee1450210f55ebeab401654.tar.bz2
Enable reuse of FileTreeIterator and FileEntry for non subclassesrefs/changes/89/8989/2
For EGit change I2c41d86b8b74c2a334433de1bbfed5b36af872bf, ContainerTreeIterator also needs to create entries for File objects in case of filtered resources. Instead of reimplementing FileEntry there, make the constructor public so that it can be reused. Also allow to pass a WorkingTreeIterator instead of a FileTreeIterator in FileTreeIterator's constructor, which is enough and allows to pass other subclasses. Bug: 358901 Change-Id: Ie0f9c9434ef7d73a8d73d4fe46db4147ded1d267 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
index 315d909..cd594ce 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
@@ -120,7 +120,8 @@ public class FileTreeIterator extends WorkingTreeIterator {
* the subdirectory. This should be a directory contained within
* the parent directory.
*/
- protected FileTreeIterator(final FileTreeIterator p, final File root, FS fs) {
+ protected FileTreeIterator(final WorkingTreeIterator p, final File root,
+ FS fs) {
super(p);
directory = root;
this.fs = fs;
@@ -155,7 +156,15 @@ public class FileTreeIterator extends WorkingTreeIterator {
private long lastModified;
- FileEntry(final File f, FS fs) {
+ /**
+ * Create a new file entry.
+ *
+ * @param f
+ * file
+ * @param fs
+ * file system
+ */
+ public FileEntry(final File f, FS fs) {
file = f;
if (f.isDirectory()) {