Implement a new .git/index (aka dircache) read interface
commit557714b2e01d06936afd8ed4db2bfc4f81f43767
authorShawn O. Pearce <spearce@spearce.org>
Tue, 12 Aug 2008 01:07:53 +0000 (11 18:07 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Thu, 14 Aug 2008 17:33:19 +0000 (14 19:33 +0200)
treeded75bf0a5c3778f3e42b0824f86cdfe4672a8e0
parentf799b5d6b51c05ddfe7ed36ad4e3846506133a20
Implement a new .git/index (aka dircache) read interface

This is a smaller (and faster) .git/index file reader and it will be
an eventual replacement for the current GitIndex class.

We silently skip optional extensions, which means we silently skip the
current 'TREE' extension.  We also fail out if we identify a required
extension which we do not support.

Most of each index entry is held in a shared byte[] as we do not need
most of the fields in jgit, due to Java's lack of a POSIX lstat like
utility.  This makes it more efficient for us to read the C Git index
format as we can avoid expending a lot of CPU on decode calls during
the file read.

Lookup is handled by binary searching against the encoded paths, as
this lines up better with how TreeWalk and its TreeFilters operate.
Most of the time when we are looking for something in the index it
is a quick read-find+update-write cycle affecting only a handful of
paths.  Avoiding any unnecessary byte[]->String->byte[] translations
during these operations performance.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/dircache/DirCache.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheEntry.java [new file with mode: 0644]