Skip to content

Package.Fetch: fix Git package fetching #18992

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
merged 1 commit into from
Feb 19, 2024

Conversation

ianprime0509
Copy link
Contributor

This commit works around #18967 by adding an AccumulatingReader, which accumulates data read from the underlying packfile, and by keeping track of the position in the packfile and hash/checksum information separately rather than using reader composition. That is, the packfile position and hashes/checksums are updated with the accumulated read history data only after we can determine what data has actually been used by the decompressor rather than merely being buffered.

The only addition to the standard library APIs to support this change is the unreadBytes function in std.compress.flate.Inflate, which allows the user to determine how many bytes have been read only for buffering and not used as part of compressed data.

These changes can be reverted if #18967 is resolved with a decompressor that reads precisely only the number of bytes needed for decompression.

This commit works around ziglang#18967 by adding an `AccumulatingReader`, which
accumulates data read from the underlying packfile, and by keeping track
of the position in the packfile and hash/checksum information separately
rather than using reader composition. That is, the packfile position and
hashes/checksums are updated with the accumulated read history data only
after we can determine what data has actually been used by the
decompressor rather than merely being buffered.

The only addition to the standard library APIs to support this change is
the `unreadBytes` function in `std.compress.flate.Inflate`, which allows
the user to determine how many bytes have been read only for buffering
and not used as part of compressed data.

These changes can be reverted if ziglang#18967 is resolved with a decompressor
that reads precisely only the number of bytes needed for decompression.
@andrewrk
Copy link
Member

Thanks for doing this. I'll pay close attention to your collaboration with @ianic in #18967 for any follow-up changes.

@andrewrk andrewrk merged commit 80f3ef6 into ziglang:master Feb 19, 2024
@ianprime0509 ianprime0509 deleted the fix-git-fetch-2 branch March 26, 2024 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants