This makes it easier to set any MutableObjectId to the same value
as the zeroId. Its logical to ask for a ".clear()" invocation when
you are writing application code, and its more efficient for the
JIT if we do 5 zero writes then to perform a copy from the zeroId
singleton.
Signed-off-by: Shawn O. Pearce <redacted>
---
.../src/org/spearce/jgit/lib/MutableObjectId.java | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java
index 5b16345..fadebab 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java
@@ -66,6 +66,15 @@ MutableObjectId(MutableObjectId src) {
this.w5 = src.w5;
}
+ /** Make this id match {@link ObjectId#zeroId()}. */
+ public void clear() {
+ w1 = 0;
+ w2 = 0;
+ w3 = 0;
+ w4 = 0;
+ w5 = 0;
+ }
+
/**
* Convert an ObjectId from raw binary representation.
* --
1.6.1.rc4.301.g5497a