Skip to content

Conversation

@Hydrotoast
Copy link
Contributor

@Hydrotoast Hydrotoast commented Jul 23, 2025

These changes resolve nonnormalized line endings (CRLF) in the git index. The CRLF endings in the index are incompatible with many git configurations and interfere with git commands (e.g. cannot change branches without force). If the git index line endings are normalized as LF, git clients can choose LF or CRLF for local worktrees.

Note

To find the nonnormalized files with CRLF in the git index.
$ git ls-files --eol | grep 'i/crlf'
i/crlf  w/crlf  attr/                   AirlockDoor/AirlockDoor.cs
i/crlf  w/crlf  attr/                   AirlockDoor/AirlockDoorTransitionLayer.cs
i/crlf  w/crlf  attr/                   DecorReimagined/DecorReimagined.csproj
i/crlf  w/crlf  attr/                   DecorReimagined/DecorReimaginedPatches.cs
i/crlf  w/crlf  attr/                   FastTrack/FastCmps.cs
i/crlf  w/crlf  attr/                   FastTrack/FastTrack.csproj
i/crlf  w/crlf  attr/                   FastTrack/FastTrackMod.cs
i/crlf  w/crlf  attr/                   FastTrack/FastTrackOptions.cs
i/crlf  w/crlf  attr/                   FastTrack/FastTrackStrings.cs
i/crlf  w/crlf  attr/                   FastTrack/GamePatches/LookupAttributeConverter.cs
i/crlf  w/crlf  attr/                   FastTrack/PathPatches/AsyncPathPatches.cs
i/crlf  w/crlf  attr/                   FastTrack/SensorPatches/FastGroupProber.cs
i/crlf  w/crlf  attr/                   FastTrack/SharedPatches.cs
i/crlf  w/crlf  attr/                   FastTrack/UIPatches/UIPatches.cs
i/crlf  w/crlf  attr/                   FinishTasks/FinishTasksPatches.cs
i/crlf  w/crlf  attr/                   QueueForSink/QueueForSink.csproj
i/crlf  w/crlf  attr/                   QueueForSink/WorkCheckpoint.cs
i/crlf  w/crlf  attr/                   README.md
i/crlf  w/crlf  attr/                   TileTempSensor/TileTempSensor.csproj
i/crlf  w/crlf  attr/                   TileTempSensor/TileTempSensorConfig.cs
i/crlf  w/crlf  attr/                   ToastControl/ToastControlOptions.cs
i/crlf  w/crlf  attr/                   ToastControl/ToastControlPopups.cs
i/crlf  w/crlf  attr/                   ToastControl/ToastControlStrings.cs

There are two steps to normalize the line endings:

  1. Add .gitattributes file to specify text files to normalize.
  2. Renormalize text nonnormalized files.

For step (1), we add an entry in .gitattributes for each file extension in the repository. To protect binary files (images, assemblies, etc.) from corruption during line ending normalization, we assign the binary attribute to the relevant extensions. The remaining files are text files with the text attribute eligible for line ending normalization. As a starting point, the entries provided are conservative (i.e. avoids opinions on style).

Note

To find the unique file extensions in the repository (excluding .gitignore files).
PS> git ls-files | Get-Item | foreach Extension | sort | unique
.bytes
.cs
.csproj
.default
.dll
.gif
.gitignore
.json
.md
.mo
.png
.po
.pot
.props
.scml
.sln
.targets
.txt
.xcf
.yaml
.yml

For step (2), we run a git command to renormalize any nonnormalized files in the git index:

PS> git add --renormalize .

Aside from the file .gitattributes, all other file changes reflect changes in line endings.

After these changes, all text files in the git index should be normalized. To verify, the following git command should have no output:

$ git ls-files --eol | grep 'i/crlf'

@peterhaneve
Copy link
Owner

While I like the idea of gitattributes it appears that trying to cherry-pick, revert, etc to older commits hits an illegal state.

I will cherry pick just the EOL changes and avoid the gitattributes for now.

airenelias pushed a commit to airenelias/peterhaneve-ONIMods that referenced this pull request Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants