← 输入框|github.com|刷新
Skip to content

fix/stream copy short reads - #2327

Merged
Byron merged 2 commits into
mainfrom
fix/stream-copy-short-reads
Oct 29, 2026
Merged

Byron merged 2 commits into
mainfrom
fix/stream-copy-short-reads

Conversation

@Byron

@Byron Byron commented Oct 29, 2026

Copy link
Copy Markdown
Member

supersede #2321

Copilot AI balanced review requested due to automatic review settings October 29, 2026 21:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

gavenren and others added 2 commits October 29, 2026 22:09
`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)
- simplify test (remove threads)
@Byron
Byron force-pushed the fix/stream-copy-short-reads branch from e386a54 to eb613ec Compare October 29, 2026 21:10
Copilot AI balanced review requested due to automatic review settings October 29, 2026 21:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the change to prevent stream-copy truncation after short reads.

No open issues 🎉

Review effort: Balanced

@Byron
Byron merged commit 38992bc into main Oct 29, 2026
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants