Repository navigation
Preserve binary markers when formatting Git patches - #738
Open
liugedragon wants to merge 1 commit into
Open
liugedragon wants to merge 1 commit into
liugedragon wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Formatting a parsed Git binary diff currently drops its
isBinaryflag on the next parse. The formatted output contains only thediff --gitline and any mode/rename headers, so consumers lose the indication that the file content needs separate handling.Emit a
Binary files ... differsummary for Git patches markedisBinary, using the existing filename quoting and/dev/nullfor creations/deletions. Document that this preserves the marker rather than binary file data.Seven regressions cover modifications, creations, deletions, renames, copies, quoted filenames, and mixed text/binary multi-file patches. All seven fail before the fix and pass afterward. Actual
git diff --no-indexoutput for synthetic binary modification/creation/deletion cases also retains its flag after the round trip.Validation on Windows / Node 22.18.0:
yarn build: passed, including lint, CJS/ESM generation, type checks, and bundles (one existing TODO warning).yarn mocha 'test/patch/**/*.js': 194 passing.yarn test: 323 passing, with the same two async timing failures present on the unchanged baseline (316 passing):should not wait for a timer between iterations in async modeanddoes not starve timers while it runs. No test timeouts or async implementation were changed.git diff --check: passed.Additional validation on Ubuntu 22.04 (WSL x86_64), Node 22.18.0 and Yarn 4.18.1: a clean source export with
yarn install --immutableand the fullyarn testcommand passed, including build, type checks, bundles, coverage and all 325 tests. The unchanged upstream base passed all 318 tests in the same environment.