Skip to content
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

Commit the html files with the right line-ends #2045

Merged
merged 4 commits into from
Aug 26, 2023
Merged

Commit the html files with the right line-ends #2045

merged 4 commits into from
Aug 26, 2023

Conversation

fridrich
Copy link
Contributor

Every time git touches the repository, the CRLF->LF conversion is done. There are still html files in docs that have the wrong line-end. So every time one does for instance "git pull", there are local uncommitted changes. This pull request simply pushes the html files after the conversion, so that they have the right line-endings and so that there are not local changes generated every time.

@remkop
Copy link
Owner

remkop commented Jun 28, 2023

Sorry for the late response @fridrich, this dropped off my inbox horizon...

I remember doing something similar recently after feedback from @deining; and I am guessing that perhaps the latest 4.7.4 release has undone my manual changes.
I can merge your PR, I don't see any issue with that, but I suspect that after the next release we will have the same issue again. So I am wondering what causes this...

I build releases on Windows.
If you look at the .gitattributes file for this project, you will see this line:

*.html          text eol=lf

My understanding is that this configuration should cause git to convert any CRLF line endings to LF before committing, so that the .html files in the repository only have LF line endings.
Apparently this is conversion not happening...

Looking at this StackOverflow answer, and the linked article, it is also possible that your git configuration for core.eol is incorrect. My understanding is that native is the default, and likely the value you want.

You can run git config --global core.eol to see what this value is set to on your system. If nothing comes back that means you are on the using the default which is native.

Next, the article has some details on what happens when git writes to the object database and to the working directory.
Looking at the .gitattributes file for the picocli project, everything looks correct.
The only thing I could think of was that perhaps you are using what the article calls The Old System, which depends on the core.autocrlf configuration setting.

You can run git config --global core.autocrlf to see what this value is set to on your system. If nothing comes back that means you are on the using the default which is false. If you work on Windows you may want to set this to true.

Can you take a look at this, try the above and let me know your findings?

@remkop remkop added type: doc 📘 theme: build An issue or change related to the build system labels Jun 28, 2023
@remkop
Copy link
Owner

remkop commented Aug 14, 2023

Hi @fridrich have you had a chance to look at my previous comment? I'm curious to your feedback.

@fridrich
Copy link
Contributor Author

Hi @fridrich have you had a chance to look at my previous comment? I'm curious to your feedback.

I mean that configuration converts the files every time git is invoked. Just those files under version control have CRLF line endings. It is needed to commit them then with the new LF line ending. If they are not committed, they will always be uncommitted changes in the git repository. Even if you do git reset --hard

@remkop remkop self-assigned this Aug 25, 2023
@remkop remkop added this to the 4.7.5 milestone Aug 26, 2023
@remkop remkop merged commit 2716d09 into remkop:main Aug 26, 2023
14 of 41 checks passed
remkop added a commit that referenced this pull request Aug 26, 2023
@remkop
Copy link
Owner

remkop commented Aug 27, 2023

Hi @fridrich I merged your PR, thank you!

I also just did a release (4.7.5), so many HTML files were generated from the Asciidoc files again.
I hope that this did not mess up the line endings again, can you check?

@deining
Copy link
Contributor

deining commented Aug 27, 2023

I also just did a release (4.7.5), so many HTML files were generated from the Asciidoc files again. I hope that this did not mess up the line endings again, can you check?

Just gave it a try, and everything is fine! Seems like this issue is resolved eventually! Thanks to all for their efforts!

@remkop
Copy link
Owner

remkop commented Aug 27, 2023

@deining Thank you for checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: build An issue or change related to the build system type: doc 📘
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants