Repository navigation
Closed
Labels
area:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows TerminalWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminalarea:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behaviorBuilt-in tools: file editing, shell, search, LSP, git, and tool call behavior
Description
Describe the bug
- Have any file with LF line endings.
- Do any prompt that gets copilot to edit the file
- The file has been changed to CRLF line endings
Affected version
0.0.395 Commit: 4b4fe6e
Steps to reproduce the behavior
PS C:\Dev\vcpkg-tool> copilot
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ╭─╮╭─╮ │
│ ╰─╯╰─╯ GitHub Copilot v0.0.395 │
│ █ ▘▝ █ Describe a task to get started. │ Copilot uses AI, so always check for mistakes. │
│ ▔▔▔▔ │
│ Pick a model with /model. Delegate changes with an AI-generated PR using /delegate. │
│ Enter ? to see all commands. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
❯ In @src\vcpkg.cpp under `#include <vcpkg/cgroup-parser.h>` add a comment describing why this header is included.
✓ Read src\vcpkg.cpp lines 1-160
└ 164 lines read
✓ Edit src\vcpkg.cpp
● Comment added above cgroup-parser include explaining its use for container detection.
Total usage est: 1 Premium request
API time spent: 7s
Total session time: 51s
Total code changes: +0 -0
Breakdown by AI model:
gpt-5.1-codex-max 40.9k in, 384 out, 19.3k cached (Est. 1 Premium request)
Resume this session with copilot --resume=2e8f3876-d7d5-430d-86f6-2b2ef57e1717
Now src\vcpkg.cpp got changed to CRLF line endings.
My .gitattributes is:
cat .\.gitattributes
# Don't allow people to merge changes to these generated files, because the result
# may be invalid. You need to run "rush update" again.
ce/pnpm-lock.yaml merge=binary
ce/shrinkwrap.yaml merge=binary
ce/npm-shrinkwrap.json merge=binary
# Disable line ending smudges entirely.
* -text
# Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic
# syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor
# may also require a special configuration to allow comments in JSON.
#
# For more information, see this issue: https://github.com/Microsoft/web-build-tools/issues/1088
#
*.json linguist-language=JSON-with-Comments
*.png binary
*.gif binary
*.mp4 binary
Expected behavior
The file that started with LF line endings keeps LF line endings.
Additional context
No response
Reacted by Johannes Schindelin, IanG, Aljaz Kovac, Ryan West, JB, David Obee, TLS-Terminator, Yukun Guo and rsp9u
Metadata
Metadata
Assignees
Labels
area:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows TerminalWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminalarea:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behaviorBuilt-in tools: file editing, shell, search, LSP, git, and tool call behavior
Activity
BillyONeal commentedon Jan 27, 2026
When I tested this a few weeks ago I could have swore I tried different models and got the same behavior with all of them but this MAY be gpt-5.1-codex-max's fault.
dscho commentedon Mar 15, 2026
This happens to me now, too, with Claude Opus 4.6. It's definitely a new thing.
IanGraingerGMSL commentedon Mar 24, 2026
I've seen Copilot creating files with CRLF when everything else is LF and my
.gitattributeshas:* text eol=lfBillyONeal commentedon Apr 1, 2026
Is it possible that somewhere under the covers this is being piped through PowerShell commands? PowerShell's
>operator does this rewriting.angeldeejay commentedon Apr 24, 2026
I'm at the same place as you. I've solved the problem by installing an external tool and wiring it to the context, telling the agent to use it after saving files. If it can be useful to you, feel free to use it /eol-converter-enhanced
sandynz commentedon May 11, 2026
Still reproducible in GitHub Copilot CLI v1.0.44 (2026-05-11) and v1.0.49 (2026-05-19) on Windows 11 / PowerShell 7.
Evidence (v1.0.44, Windows 11 / PowerShell 7, 2026-05-11):
A test file was created via the
createtool with LF-only content (5 lines).Raw byte inspection immediately after write:
Every line ending is
0D 0A(CRLF). The.gitattributesfile in the repo rootspecifies
* text=auto eol=lf, which is ignored by the tool's write path.Evidence (v1.0.49, Windows 11 / PowerShell 7, 2026-05-19):
Independently reproduced with a 3-line file via
createtool:A pre-commit hook (
scripts/hooks/pre_commit_normalize.py) fires on every session,confirming the injected CRLF is a consistent, repeatable behaviour.
Correction to cascading effect: An earlier report noted that CRLF files could break
subsequent
editcalls whenold_strspans multiple lines. Further testing (v1.0.49,2026-05-19) showed that the
edittool does normalize line endings duringold_strmatching — LF
old_strsuccessfully matches CRLF file content. The cascade risk istherefore not from
old_strmatching failures, but from downstream Python/scriptprocessing that re-introduces CRLF when not using
newline='\n'.Patch Tuesday for May 2026 (#51854)
PacePioneer commentedon Sep 15, 2026
This happens to me almost daily, and the agent uses more tokens to solve it. I'm surprised this is still an issue