Skip to content

[ci] Fix apply-gist workflow failing on gist diffs with CRLF line endings - #26350

Merged
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/apply-gist-crlf
Jul 29, 2026
Merged

[ci] Fix apply-gist workflow failing on gist diffs with CRLF line endings#26350
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/apply-gist-crlf

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

The /apply-gist <gist-url> PR command downloads unified *.txt.diff files from a gist and applies them to tests/dotnet/UnitTests/expected/*.txt with git 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 \r characters. Because the expected files in the repo use LF, git apply failed with patch 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 \r from the same gist's diffs let all of them apply cleanly.

🤖 Pull request created by Copilot

…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
Copilot AI review requested due to automatic review settings July 29, 2026 16:09

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.

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\n and stray \r to \n before processing.
  • Ensure downloaded unified *.txt.diff patches apply cleanly against the repo’s LF-terminated expected files.

@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Jul 29, 2026
@rolfbjarne
rolfbjarne enabled auto-merge (squash) July 29, 2026 17:41
@rolfbjarne
rolfbjarne merged commit a030377 into main Jul 29, 2026
12 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/apply-gist-crlf branch July 29, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants