Replies: 2 comments
|
Your
Git for Windows sets Why the host is clean but the container is dirtyWith Minimal reproduction: $ git ls-files --eol # after clone with autocrlf=true
i/lf w/crlf attr/ file.txt
$ git status --porcelain # host: clean
$ git -c core.autocrlf=false status --porcelain
M file.txt # container's view: modifiedFixing the clone you already haveChanging the setting alone does nothing — the files have to be rewritten: $ git config core.autocrlf input
$ git rm --cached -r .
$ git reset --hardI verified both halves: after the config change alone, Alternatively, clone into the WSL2 filesystem ( For the repository itselfA * text=auto eol=lfI tested this as well: with that file committed, a fresh clone on a machine with Your three questions
Your working tree isn't actually modified, only the byte-level comparison differs. Once |
|
Thominho's diagnosis is right, and your own git ls-files --eol output confirms it: i/lf w/crlf means the blobs are LF and your working tree is CRLF, so the Linux container reads every one of them as modified. One thing worth adding to the fix, because it can cost you work. git reset --hard discards any uncommitted changes along with the line endings. If you have edits in there you care about, the safer way to apply a new .gitattributes is: That rewrites the index entries to match the attributes without touching your working tree, so you can see the normalisation as a single reviewable change and commit it. Same result, and nothing is lost if you were mid-edit. On your third question: cloning into the WSL2 filesystem is worth doing for a dev container whatever the line endings do. A bind mount from a Windows path into a Linux container goes through a translation layer, and file watching and dependency installs are noticeably slower through it. |
Uh oh!
There was an error while loading. Please reload this page.
Hi!
I'm working on fixing issue #4765.
I was able to reproduce the bug and have a working fix locally , fixes the JPEG EXIF orientation issue).
Before opening the PR, I noticed a Git problem when using the provided Dev Container on Windows.
My workflow:
git status.On Windows:
Output:
Immediately after opening the Dev Container (without editing any files):
Git reports hundreds of modified files.
I also checked:
Output:
The repository doesn't seem to contain a
.gitattributesfile.Is there a recommended workflow for Windows contributors using the Dev Container?
I'd like to submit a clean PR containing only the fix for issue #4765.
Thanks!
All reactions