Fixes #5405 - binary file handling in the Commit Composer#5440
Open
nshepperd wants to merge 1 commit into
Open
Fixes #5405 - binary file handling in the Commit Composer#5440nshepperd wants to merge 1 commit into
nshepperd wants to merge 1 commit into
Conversation
Composing or recomposing changes that include a binary file failed at commit time with "error: cannot apply binary patch to '<file>' without full index line". The composer collected diffs without `--binary`, so binary changes were carried only as `Binary files ... differ` placeholders, which `git apply` rejects when the composed commits are replayed. - Adds a `binary` option to the git diff providers that passes `--binary`, emitting full `GIT binary patch` blocks (with full index lines) instead of the placeholder markers - Collects composer diffs with `--binary`, so binary changes are committed byte-identically - Redacts the base85 binary patch bodies before hunks are sent to the composer webview or embedded in AI prompts; apply uses the original un-redacted hunks, so no data is lost Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Oh right, I also have a bunch of e2e integration tests (mostly written by Claude Fable) for the bugs that I've found, including this one. I could separate out the test for binary file handling and include it in this PR as a regression test if you want. Or make a separate PR that has all of them, idk. Right now they are at https://github.com/nshepperd/vscode-gitlens/tree/e2e-compose-tests |
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.
Description
Fixes #5405.
The composer (legacy/non-compose-tools path) collects its diffs without --binary, so binary changes are carried only as Binary files ... differ placeholders, which git apply rejects when the composed commits are replayed.
Verified with the repro from #5405 (I used Recompose Commits from here...).
Maybe this is actually a new feature since legacy compose never supported binary...? IDK, it looked like a bug when originally I filed it :)
Checklist
Fixes $XXX -orCloses #XXX -prefix to auto-close the issue that your PR addresses