Skip to content

Prefetch tests: Delete multi-pack-index before indexing a pack #1213

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

Merged

Conversation

derrickstolee
Copy link
Contributor

@derrickstolee derrickstolee commented May 29, 2019

This test deletes an existing .idx file, and then checks that
VFS for Git calls git index-pack when scanning the pack-files.
When we take Git 2.22.0, this test starts to fail. The fix is to
delete the multi-pack-index before rebuilding the .idx. This is
a reasonable expectation because we won't have a pack covered by
the multi-pack-index without having the corresponding .idx file.

The reason this broke with Git 2.22.0 is a bit subtle:

When running git index-pack, Git looks for duplicate objects in
order to check for SHA-1 collisions. When the multi-pack-index
includes the objects in the pack, Git sees what it thinks are
the same object ids and goes to load the content to verify they
are equal.

In Git 2.22.0, we solved the "many packs" problem by adding the
pack-files from the multi-pack-index to the packed_git linked
list. Adding to this list will fail if there is no corresponding
.idx file. (The multi-pack-index prevents any reads into this
.idx file, but existence is required.) This means that the content
lookup fails and Git complains with "fatal: cannot read existing
object info"

This will unblock taking Git 2.22.0 after the release. See
microsoft/git#140 for details on that update.

This test deletes an existing .idx file, and then checks that
VFS for Git calls `git index-pack` when scanning the pack-files.
When we take Git 2.22.0, this test starts to fail. The fix is to
delete the multi-pack-index before rebuilding the .idx. This is
a reasonable expectation because we won't have a pack covered by
the multi-pack-index without having the corresponding .idx file.

The reason this broke with Git 2.22.0 is a bit subtle:

When running `git index-pack`, Git looks for duplicate objects in
order to check for SHA-1 collisions. When the multi-pack-index
includes the objects in the pack, Git sees what it thinks are
the same object ids and goes to load the content to verify they
are equal.

In Git 2.22.0, we solved the "many packs" problem by adding the
pack-files from the multi-pack-index to the packed_git linked
list. Adding to this list will fail if there is no corresponding
.idx file. (The multi-pack-index prevents any reads into this
.idx file, but existence is required.) Since the .idx file is not
there, that add fails. This means that the content lookup fails
and Git complains with "fatal: cannot read existing object info"

Signed-off-by: Derrick Stolee <[email protected]>
@dscho
Copy link
Member

dscho commented May 29, 2019

Excellent investigation, and even better explanation of the issue and its resolution. Thanks!

@derrickstolee
Copy link
Contributor Author

/azp run GitHub VFSForGit Mac Functional Tests

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@derrickstolee derrickstolee merged commit 9169541 into microsoft:master May 29, 2019
@jrbriggs jrbriggs modified the milestones: M155, M153 Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants