[ci] Fix apply-gist workflow failing on gist diffs with CRLF line endings - #26350
Merged
Conversation
…ings The /apply-gist command downloads unified diffs from a gist and applies them with 'git apply -p1'. GitHub can serve gist file content with CRLF line endings, which were written to disk verbatim on the Linux runner. Since the expected files in the repo use LF, 'git apply' failed with "patch does not apply" (e.g. run 30468376709). Normalize the downloaded gist content to LF before writing it, so the diffs apply cleanly regardless of how the gist stored its line endings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: dca8105c-07a8-4093-b347-d5ce5c195507
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a reliability issue in the /apply-gist <gist-url> workflow by normalizing downloaded gist content to LF line endings before writing diffs/full files to disk, preventing git apply failures on Linux when gists are served with CRLF.
Changes:
- Normalize gist file content by converting
\r\nand stray\rto\nbefore processing. - Ensure downloaded unified
*.txt.diffpatches apply cleanly against the repo’s LF-terminated expected files.
rolfbjarne
enabled auto-merge (squash)
July 29, 2026 17:41
dalexsoto
approved these changes
Jul 29, 2026
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.
The
/apply-gist <gist-url>PR command downloads unified*.txt.difffiles from a gist and applies them totests/dotnet/UnitTests/expected/*.txtwithgit apply -p1.GitHub can serve gist file content with CRLF line endings. The workflow wrote the downloaded content to disk verbatim, so on the Linux runner the diffs retained embedded
\rcharacters. Because the expected files in the repo use LF,git applyfailed withpatch does not apply— see run 30468376709.This normalizes the downloaded gist content to LF before writing it, so the diffs apply cleanly regardless of how the gist stored its line endings. Verified manually: stripping
\rfrom the same gist's diffs let all of them apply cleanly.🤖 Pull request created by Copilot