Define static ASCII encoded type strings for ObjectId computation
commitb3b088e32f2e7061a0eb7824d0fd003638508203
authorShawn O. Pearce <spearce@spearce.org>
Sun, 11 May 2008 18:09:59 +0000 (11 14:09 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 11 May 2008 19:12:44 +0000 (11 15:12 -0400)
tree4a464aa404dcaf1f9300879c09e660c5c2b83147
parentce149daa74a811b45fb8946ed491fcfa1e4b5f15
Define static ASCII encoded type strings for ObjectId computation

We frequently need to compute the ObjectId of something, and to do
that we must embed the type name as an ASCII string into the header
as part of the digest calculation.  This means we are often building
these ASCII encoded strings, but there's only 4 possible values in
Git so it doesn't make sense to keep redoing the String->byte[] on
every ObjectId computation.  Instead we store them as static byte[]
and pray nobody will be foolish enough to edit our constant data.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit.test/tst/org/spearce/jgit/lib/ReadTreeTest.java
org.spearce.jgit/src/org/spearce/jgit/lib/Constants.java
org.spearce.jgit/src/org/spearce/jgit/lib/ObjectLoader.java
org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java