Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git/odb/pack: implement v2 object searching #2422

Merged
merged 4 commits into from
Jul 24, 2017
Merged

Conversation

ttaylorr
Copy link
Contributor

This pull request implements object searching for v1 index files, and is the third in the series started by #2420.

It implements the v2 index lookup, similar to that implemented in #2421.

The v2 index format varies slightly from v1. Instead of placing the object offset and object name next to each other, they are split into separate "tables". v2 also knows how to store a cyclic redundancy check for each object, as well how to encode 8-byte unsigned offsets.

More specifically, the structure is as follows:

  1. A magic 4-byte header
  2. A 4-byte version tag (network order)
  3. 256 4-byte network order unsigned integers comprising the L1 fanout table.
  4. The 20-byte object names, in order.
  5. 4-byte entries for each object giving the CRC in network byte order.
  6. 4-byte "small" offsets. If the most significant bit of this is set (i.e., x&0x8000000 > 1), the rest of the offset encodes the location of an 8-byte offset in the same file.

The v2Search function introduced in this pull request understands the above format and can search through it.


/cc @git-lfs/core @peff
/cc #2415

@ttaylorr ttaylorr changed the base branch from git-odb-pack-idx to master July 24, 2017 17:18
@ttaylorr ttaylorr merged commit ce66ce3 into master Jul 24, 2017
@ttaylorr ttaylorr deleted the git-odb-pack-idx-v2 branch August 29, 2017 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants