-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
eol=crlf in gitattributes produces unwanted outcomes on windows/linux mixed environments #493
Comments
reading up a lot on this topic, it seems that setting So maybe all the generator should do is print out a warning when |
AFAIK (from this list) only
* text=auto
*.cs text diff=csharp
- *.ps1 text eol=crlf
+ *.ps1 text
*.bat text eol=crlf
*.sln text eol=crlf
- *.csproj text eol=crlf
+ *.csproj text
- tasks.json text eol=crlf
+ tasks.json text
*.sh text eol=lf
*.md text whitespace=-trailing-space
# Exclude files from exporting
.gitattributes export-ignore
.gitignore export-ignore It might make sense to follow what the .NET team uses on their own repositories. Sampling a few repos, seems to confirm that only |
There is a reason why those files are forced as crlf:
That isn't entirely correct. |
Really? I was under the impression that The reason I created this issue was that for all projects created from this template I always have "problems" when dependabot updates a csproj.
all that went away, when I removed |
hmm, the only time I have seen that happen is when the files have had a commit before adding a gitattributes file, and thus not being normalized before they are changed again. it is also possible that dependabot just respects the |
Not sure about that. As I said, the problem went away after I set But there's really no need to dwell on this. I though "everyone" had the same problem I had (until I set |
Let us keep the issue open, it is something I would like to come back to in the future to investigate. |
I'm not sure whether this is really a bug in the generator or rather a problem in the windows defaults of git, but:
The generator generates
.gitattributes
with content:This leads to csproj being converted to
crlf
during checkout on non-windows systems (actually on windows-systems, too but here that's the default...)At the same time, during checkin on windows (or rather on systems with
core.autocrlf=true
) those line-endings will be converted tolf
,Now, the problem starts when development is done on windows and linux (or on windows and having dependabot create PRs): While windows-systems will always checkin
lf
line-endings, the non-windows-systems will checkincrlf
line-endings.To demonstrate I have created a simple repository and let dependabot make PRs:
*.csproj text eol=crlf
set in.gitattributes
:While I do see that this is also (maybe more so) the fault of the windows-default of setting
core.autocrlf=true
, may I ask: Is there a reason for settingeol=crlf
? It does nothing on windows-systems and while it converts the files during checkout on non-windows-systems the files shuold have been created correctly in the first place. Or am I missing something?The text was updated successfully, but these errors were encountered: