Skip to content

Conversation

@Andrej730
Copy link
Contributor

I'm having huge trouble switching between branches on Windows after 1174c49 - autocrlf, that's used on Windows, is fighting against entire repo marked as LF by .gitattributes settings (since it's marking files as LF not just on index but on the work folder too).
This shouldn't be necessary - * text=auto makes git autodetect files as text and then they're handled by core.eol, which is native by default - native means to use platform's line endings locally (crlf on Windows and lf on unix) and commit to index as lf. Or if .gitattributes overrides it, then different line endings will be used locally - e.g. *.sh text eol=lf stores .sh files as lf even on Windows, since it's necessary.
See https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreeol

Also noticed some files on index were stored as crlf - it seems it was by accident, renormalizing them for consistency.

git ls-files --eol | grep i/crlf
# i/crlf  w/crlf  attr/text=auto          tests/python/fake_bpy_module_test/fake_bpy_module_test/analyzer_test_data/base_analyzer_test/input/only_module_class.rst
# i/crlf  w/crlf  attr/text=auto          tests/python/fake_bpy_module_test/fake_bpy_module_test/generator_test_data/code_document_node_translator_test/expect/basic/basic.py
# i/crlf  w/crlf  attr/text=auto          tests/python/fake_bpy_module_test/fake_bpy_module_test/transformer_test_data/bpy_module_tweaker/expect/add_bpy_ops_override_parameters.xml
# i/crlf  w/crlf  attr/text=auto          tests/python/fake_bpy_module_test/fake_bpy_module_test/transformer_test_data/bpy_module_tweaker/expect/add_bpy_ops_override_parameters_transformed.xml
# i/crlf  w/crlf  attr/text=auto          tests/python/fake_bpy_module_test/fake_bpy_module_test/transformer_test_data/bpy_module_tweaker/expect/add_bpy_ops_override_parameters_transformed_before_v4.xml
# i/crlf  w/crlf  attr/text=auto          tests/python/fake_bpy_module_test/fake_bpy_module_test/transformer_test_data/mod_applier_test/expect/new_data.mod.xml
# i/crlf  w/crlf  attr/text=auto          tests/python/fake_bpy_module_test/fake_bpy_module_test/transformer_test_data/mod_applier_test/expect/update_data.mod.xml

@@ -1 +1,2 @@
* text eol=lf
* text=auto
*.sh text eol=lf
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you apply this on .sh file only?
We should apply lf to all files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we apply lf to all files, then it creates issues on Windows - since Windows is using crlf, some Windows programs will keep saving files as crlf producing git warnings when working with the repo. And git itself has autocrlf on Windows enabled by default - so it's checking out lf files as crlf to avoid the issues above and applying lf to everything is conflicting with this.

When we do * text=auto files are still will be stored on the repo as lf - so if you're on Unix, you'll never see crlf files. It's just that auto will check out them on Windows as crlf to avoid issues above. Though we still need to apply lf to .sh scripts, otherwise there will be issues executing them on Windows.

@Andrej730 Andrej730 force-pushed the renormalize-lineendings branch from 062fddf to b0e1a94 Compare December 3, 2025 18:40
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