Go to file
Shawn O. Pearce a7c60cfc6d Add basic support to read pack-*.idx v1 and v2 files
The index data is mapped into memory and then scanned using a
binary search algorithm to locate the matching entry for the
supplied git_oid.  The standard fanout hash trick is applied to
reduce the search space by 8 iterations.

Since the v1 and v2 file formats differ in their search function,
due to the different layouts used for the object records, we use
two different search implementations and a virtual function pointer
to jump to the correct version of code for the current pack index.
The single function jump per-pack should be faster then computing
a branch point inside the inner loop of a common binary search.

To improve concurrency during read operations the pack lock is only
held while verifying the index is actually open, or while opening
the index for the first time.  This permits multiple concurrent
readers to scan through the same index.

If an invalid index file is opened we close it and mark the
git_pack's invalid bit to true.  The git_pack structure is kept
around in its parent git_packlist, but the invalid bit will cause
all future readers to skip over the pack entirely.  Pruning the
invalid entries is relatively unimportant because they shouldn't
be very common, a $GIT_DIRECTORY/objects/pack directory tends to
only have valid pack files.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-01-03 02:56:16 -08:00
src Add basic support to read pack-*.idx v1 and v2 files 2009-01-03 02:56:16 -08:00
tests Rewrite git_foreach_dirent into gitfo_dirent 2008-12-31 15:35:36 -08:00
.gitignore Add pkg-config support. 2008-12-30 07:31:03 -08:00
.HEADER Switch the license from BSD to GPL+libgcc exception 2008-11-01 15:55:47 -07:00
api.doxygen doxygen config: Update path to public headers 2008-12-02 08:45:03 -08:00
CONVENTIONS Move include files to include/git/, drop git_ prefix from file names 2008-11-01 15:42:23 -07:00
COPYING Switch the license from BSD to GPL+libgcc exception 2008-11-01 15:55:47 -07:00
git.git-authors Add Adam Simpkins to list of consenting authors 2008-12-09 08:36:10 -08:00
libgit2.pc.in Fix pkgconfig file wrt last added dependencies 2008-12-30 16:50:45 -08:00
Makefile Add a build variable to allow supression of -fvisibility 2008-12-31 13:45:34 -08:00