Repository navigation
fix/stream copy short reads - #2327
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change to handle short reads without truncating copied data.
No open issues 🎉
What changed in this PR
This PR fixes premature termination in GitPython’s stream_copy helper so short reads no longer truncate copied data.
Changes:
- Continue copying until an empty read signals EOF.
- Add regression tests for binary and text short reads, empty input, and a POSIX unbuffered pipe.
- Document the updated stopping condition.
| File | Description |
|---|---|
test/test_util.py |
Adds short-read, empty-input, and pipe regression tests. |
git/util.py |
Stops only on empty reads and documents the behavior. |
Review effort: Balanced
`stream_copy` stopped after any read shorter than `chunk_size`, truncating valid unbuffered streams. Continue until an empty chunk reports end of input, preserving the existing writer contract and byte count. Add binary/text short-read and empty-input regressions, plus a synchronized real POSIX pipe reproduction. The regressions fail before the fix; utility and typing modules pass with both CLI and Gix backends (126 passed, 39 skipped each). Applicable pre-commit checks pass. Assisted-by: OpenAI Codex (model: unknown, autonomous)
Byron
force-pushed
the
fix/stream-copy-short-reads
branch
from
October 29, 2026 21:10
e386a54 to
eb613ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
supersede #2321