Line Ending Preservation
GitAuto detects the original line ending style (LF vs CRLF) of each file and preserves it in the output. Without this, modifying a CRLF file with LF output creates a diff where every single line appears changed, even though no actual code changed.
Why This Exists
Windows repositories often use CRLF (\r\n) line endings, while Unix/Mac repositories use LF (\n). The model always outputs LF. When GitAuto writes the model's output to a CRLF file, every line in the diff shows as changed because the line endings differ. This creates massive, unreadable pull requests that are impossible to review. The actual code changes get buried under hundreds of whitespace-only changes.
Why Models Always Output LF
Model training data and tokenizers are normalized to LF (\n). The model has no concept of CRLF (\r\n) as distinct from LF - they are both "end of line" in the model's view. Even if the input file uses CRLF, the model generates LF because that is what its tokenizer produces. Training data is preprocessed and normalized to LF before training, so the model has never seen CRLF during training and cannot reproduce what it has never encountered.
How It Works
Before modifying a file, GitAuto reads the original content and checks whether it contains CRLF line endings. If the original file used CRLF, the output is converted from LF to CRLF before writing. If the original used LF, no conversion is needed. This detection happens per-file, so a repository with mixed line endings is handled correctly.
Related Features
- Final Newline - Ensures exactly one newline at EOF before line ending conversion
- Trailing Space Removal - Strips whitespace before line ending preservation runs
Need Help?
Have questions or suggestions? We're here to help you get the most out of GitAuto.
Contact us with your questions or feedback!