aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java36
1 files changed, 32 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
index 7189ce20a6..b3e4efb4fc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
@@ -286,7 +286,7 @@ public interface PackIndex
* the index cannot be read.
*/
void resolve(Set<ObjectId> matches, AbbreviatedObjectId id,
- int matchLimit) throws IOException;
+ int matchLimit) throws IOException;
/**
* Get pack checksum
@@ -304,6 +304,7 @@ public interface PackIndex
class MutableEntry {
/** Buffer of the ObjectId visited by the EntriesIterator. */
final MutableObjectId idBuffer = new MutableObjectId();
+
/** Offset into the packfile of the current object. */
long offset;
@@ -345,6 +346,34 @@ public interface PackIndex
r.offset = offset;
return r;
}
+
+ /**
+ * Similar to {@link Comparable#compareTo(Object)}, using only the
+ * object id in the entry.
+ *
+ * @param other
+ * Another mutable entry (probably from another index)
+ *
+ * @return a negative integer, zero, or a positive integer as this
+ * object is less than, equal to, or greater than the specified
+ * object.
+ */
+ public int compareBySha1To(MutableEntry other) {
+ return idBuffer.compareTo(other.idBuffer);
+ }
+
+ /**
+ * Copy the current ObjectId to dest
+ * <p>
+ * Like {@link #toObjectId()}, but reusing the destination instead of
+ * creating a new ObjectId instance.
+ *
+ * @param dest
+ * destination for the object id
+ */
+ public void copyOidTo(MutableObjectId dest) {
+ dest.fromObjectId(idBuffer);
+ }
}
/**
@@ -368,7 +397,6 @@ public interface PackIndex
this.objectCount = objectCount;
}
-
@Override
public boolean hasNext() {
return returnedNumber < objectCount;
@@ -393,7 +421,6 @@ public interface PackIndex
*/
protected abstract void readNext();
-
/**
* Copies to the entry an {@link ObjectId} from the int buffer and
* position idx
@@ -423,7 +450,8 @@ public interface PackIndex
/**
* Sets the {@code offset} to the entry
*
- * @param offset the offset in the pack file
+ * @param offset
+ * the offset in the pack file
*/
protected void setOffset(long offset) {
entry.offset = offset;