-
Notifications
You must be signed in to change notification settings - Fork 523
Add direct test coverage for formatPatch with headerOptions parameter #642
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
+136
−0
Conversation
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
Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com>
Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Address feedback on custom file headers in patches PR
Add direct test coverage for formatPatch with headerOptions parameter
Dec 31, 2025
test/patch/create.js
Outdated
Comment on lines
1208
to
1214
| '@@ -1,1 +1,1 @@\n' + | ||
| '-a\n' + | ||
| '+b\n' + | ||
| '\n' + | ||
| '@@ -1,1 +1,1 @@\n' + | ||
| '-x\n' + | ||
| '+y\n'; |
Collaborator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is obviously stupid, but @copilot writing it was nonetheless useful in that it brought the obviously stupid behaviour to my attention. I should be throwing an error in this scenario.
…viour (which we don't yet provide)
ExplodingCabbage
added a commit
that referenced
this pull request
Dec 31, 2025
* Add support for omitting headers * Fix some wonky pre-existing formatting * Document new options * Proofread & tweak * Further proofread * Another tweak - I guess not every Unix machine uses GNU patch, and I am quoting from the docs for the GNU version * Language tweak * More detail * Export HeaderOptions interface * Fix docs gap * Add direct test coverage for formatPatch with headerOptions parameter (#642) * Initial plan * Add direct test coverage for formatPatch with headerOptions Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com> * Refactor: Extract common patch array to reduce duplication Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com> * Remove redundant test (covered entirely below) * Make test for multiple patches with OMIT_HEADERS demand sensible behaviour (which we don't yet provide) * Fix behaviour --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com> Co-authored-by: Mark Amery <markrobertamery@gmail.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com>
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.
The
formatPatchfunction'sheaderOptionsparameter was only tested indirectly throughcreateTwoFilesPatch. This adds explicit tests for consumers callingformatPatchdirectly.Changes
#formatPatch→with headerOptions parameter:INCLUDE_HEADERSwith different file names (no Index line)INCLUDE_HEADERSwith same file name (includes Index line)FILE_HEADERS_ONLY(file headers only, no Index/underline)OMIT_HEADERS(hunks only)Example
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.