summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2012-08-15 14:33:16 +0200
committerRobin Rosenberg <robin.rosenberg@dewire.com>2012-08-15 20:20:48 +0200
commit342de38e57e3052d3d2f12e93d629bdc63f123be (patch)
tree0aff9a482f9d624c22ec40454f4679b941805c97 /org.eclipse.jgit
parent02113f7411df6d680aa520803ac8c63009696c3a (diff)
downloadjgit-342de38e57e3052d3d2f12e93d629bdc63f123be.tar.gz
jgit-342de38e57e3052d3d2f12e93d629bdc63f123be.zip
Fix idOffset when the working tree iterator matches a dircache entry
idOffset is not zero when idBuffer comes from blob in the dircache Change-Id: Iff768422cba140a5d6a776e2c627b852f079c1da
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
index ebe9f73fbd..8d0555bf95 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -131,6 +131,9 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
/** Cached canonical length, initialized from {@link #idBuffer()} */
private long canonLen = -1;
+ /** The offset of the content id in {@link #idBuffer()} */
+ private int contentIdOffset;
+
/**
* Create a new iterator with no parent.
*
@@ -234,11 +237,14 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
DirCacheIterator.class);
if (i != null) {
DirCacheEntry ent = i.getDirCacheEntry();
- if (ent != null && compareMetadata(ent) == MetadataDiff.EQUAL)
- return i.idBuffer();
+ if (ent != null && compareMetadata(ent) == MetadataDiff.EQUAL) {
+ contentIdOffset = i.idOffset();
+ contentIdFromPtr = ptr;
+ return contentId = i.idBuffer();
+ }
+ contentIdOffset = 0;
}
}
-
switch (mode & FileMode.TYPE_MASK) {
case FileMode.TYPE_FILE:
contentIdFromPtr = ptr;
@@ -427,7 +433,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
@Override
public int idOffset() {
- return 0;
+ return contentIdOffset;
}
@Override