Repository navigation
Fix line endings of mwnw.cmd - #7154
Conversation
The latest dependabot update for maven changed the line endings of mvnw.cmd to Unix line endings, even though it is a Windows file - and correctly declared as such in .gitattributes. This commit changes the line endings back to Windows format. See dependabot/dependabot-core#8693 for the depend-a-bot issue. See pmd#7140 for the offending PR that introduced the wrong line endings
|
Compared to main: (comment created at 2026-10-06 13:08:27+00:00 for 74e9549) |
|
If you having trouble updating your main branch:
Since mvnw.cmd is always modified locally, and origin/main also modifies the file... |
|
Actually, I think what happened here is:
At least, in my other repo https://github.com/adangel/summit-ast where the same dependabot PR landed, I committed the file wrongly as "lf" and the dependabot PR fixed it correctly to be "crlf" - but I have no .gitattributes there. |
|
I don't think git doesn't normalizes anything (unless told so by .gitattributes) |
|
Same happened here: pmd/build-tools#200 (which has a .gitattributes) With On main branch: Stored in index as lf (i/lf), in the checked out working tree crlf (w/crlf). In the branch that dependabot created it is:
So, dependabot changed it to crlf for storage. Since we have the text attribute, git will always normalize it to lf and then add crlf in the working tree, marking this file dirty. I've now run We could store it as crlf in the repo, but then, if someone edits this file with an editor that doesn't preserve lineendings, it could be easily broken (Windows CMD requires crlf). That's why we added the .gitattributes, so that no matter what the editor does, it is stored normalized in the git repo and on checkout it will have crlf line endings. |
We no longer normalize the line endings to lf in git storage and to crlf on checkout (-text). When dependabot updates this file, it will always store it with crlf (without using .gitattributes settings) and the file would appear always as modified. Since the file is usually not edited manually but only by wrapper:wrapper or dependabot, it's only a small risk that someone accidentally modifies the line endings to lf by manually editing the file. Same problem was previous addressed in #7154. Problematic PRs: #7140 #7359
Describe the PR
The latest dependabot update for maven changed the line endings of mvnw.cmd to Unix line endings, even though it is a Windows file - and correctly declared as such in .gitattributes.
This commit changes the line endings back to Windows format.
See dependabot/dependabot-core#8693 for the depend-a-bot issue.
See #7140 for the offending PR that introduced the wrong line endings
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)