-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
file upload doesn't respect .gitattributes to normalize CRLF line endings #17496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue also affects |
This issue is not about lfs - if you're certain that you have lfs running have the gitatrributes committed on the branch you're uploading to and you're definitely sure this should be applying then reopen a new issue giving all of the correct details. This should be working on 1.16: gitea/services/repository/files/upload.go Lines 95 to 111 in a38ab71
|
Gitea Version
1.16.0+dev-444-g40c8451b7
Git Version
No response
Operating System
No response
How are you running Gitea?
Tested via https://try.gitea.io/plgruener/testCRLF
Database
No response
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
In a Git repo with a
.gitattributes
file with contents* text=auto
, all newly added/staged files have their line terminators automatically converted from CRLF -> LF.However, when you upload and commit a file with CRLF line terminators via the Gitea webinterface, the line endings are not normalized.
You can see this when you clone the example repo: crlf.txt was given CRLF (with the
unix2dos
utility) and uploaded via "upload file".(Be careful to not enable
core.autocrlf
in your local Git config; and setcore.eol=lf
, else Git will convert every file to CRLF line endings.)Also when you edit the example file again with the web editor (which forces LF line endings), you'll see that it reports seemingly identical changes on every line, indicating a line ending conversion.
(When copy-pasting the text in the "new file" web-editor, this is not immediately an issue, because the web editor forces LF line endings. But ideally, the editor should also respect .gitattributes, see #9108.)
Expected behaviour: be able to force the line ending style on all files by respecting the
.gitattributes
, whether they are submitted by push, by web-editor or by uploading a file.If there's a workaround to just force LF on upload, that would be fine, but keep in mind that some files on Windows, eg
.bat
scripts, may require CRLF.Screenshots
No response
The text was updated successfully, but these errors were encountered: