Skip to content

Copilot-cli changes all files it touches to have CRLF line endings even when the original file has LF line endings #1148

@BillyONeal

Description

@BillyONeal

Describe the bug

  1. Have any file with LF line endings.
  2. Do any prompt that gets copilot to edit the file
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions