git/odb/pack: implement v2 object searching #2422
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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