git/odb/pack: implement v1 object searching #2421
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 second in the series started by #2420.
The main goal of this pull request is to implement a function that the
IndexVersion.Search()
function can call into, as:This implements the search functionality (i.e., find an object, or return a comparison value of where to search next) for V1 pack files.
I estimate that it's unlikely LFS will parse many v1 packfiles during regular usage. Git stopped writing v1 packfiles near git/git@c553ca2, which was first released in the v1.5.2 series, which was released earlier than our minimum supported version of Git.
That being said, I think it's important for LFS to be able to parse all packfiles, since we won't have
git-cat-file(1)
to fallback on if we can't parse an earlier packfile version.V1 packfiles have the following structure:
The
v1Search
function understands the above structure and does the appropriate search/comparison operation./cc @git-lfs/core @peff
/cc #2415