[EGIT PATCH 08/11] Expose the current entry's length, last modified in WorkingTreeIterator
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Aug 10, 2008, 08:46 UTC
- Message-ID
- <1218357986-19671-9-git-send-email-spearce@spearce.org>
- In-Reply-To
- <1218357986-19671-8-git-send-email-spearce@spearce.org>
We need the last modified time available to us in application level code so we can pull the current WorkingTreeIterator from TreeWalk and then grab the last modified time off it to compare against the index file.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- .../spearce/jgit/treewalk/WorkingTreeIterator.java | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java index cb4a089..05d9282 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java @@ -259,6 +259,25 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { pathLen = pathOffset + nameLen; } + /** + * Get the byte length of this entry. + * + * @return size of this file, in bytes. + */ + public long getEntryLength() { + return current().getLength(); + } + + /** + * Get the last modified time of this entry. + * + * @return last modified time of this file, in milliseconds since the epoch + * (Jan 1, 1970 UTC). + */ + public long getEntryLastModified() { + return current().getLastModified(); + } + private static final Comparator<Entry> ENTRY_CMP = new Comparator<Entry>() { public int compare(final Entry o1, final Entry o2) { final byte[] a = o1.encodedName;
-- 1.6.0.rc2.219.g1250ab