ExPaNDS-eu / ExPaNDS-experimental-techniques-ontology

EU Photon and Neutron Ontologies (task 3.2)
8 stars 4 forks source link

Change line ending from DOS- to Unix-style. #129

Closed paulmillar closed 2 months ago

paulmillar commented 2 months ago

Motivation:

We have inconsistent line endings at the moment: the Ontology metadata file uses Unix-style line endings while the PaNET.csv file uses DOS-style line endings. It would be better if the PaNET repository was consistent.

Moreover, Unix tools may convert DOS-style lines to Unix-style lines. This results in large diffs, making it hard to see actual changes.

Modification:

Run the dos2unix command on the PaNET.csv. This results in two changes:

Result:

More consistent choice of line ending. Removal of potentially confusing BOM.

Closes: #128

paulmillar commented 2 months ago

IMPORTANT Please note that, under the Files changed tab, it is possible to alter the diff so that it excludes whitespace-only changes.

Near the top of the Files changed tab, there is a cog-wheel icon that controls what kind of diff is shown. Selecting the cog-wheel icon shows a small pop-up menu with the option Hide whitespace. When this option is enabled, only the BOM change (on the first line) is shown. This removal of the BOM appears as a mysterious change: nothing seems to be different.

I think that enabling the "hide whitespace" option will make reviewing the patch much easier.

gkoum commented 2 months ago

Thanks for the clarification, I was kind of lost yesterday.

Maybe it would be a good idea to have something protecting the repository from reverting back to this inconsistency since not all use the same operating system. Do you suggest using dos2unix before every release?

Could we use a .gitattributes as described here to handle such cases?

* text=auto
*.csv text eol=lf
*.txt text eol=lf
paulmillar commented 2 months ago

Maybe it would be a good idea to have something protecting the repository from reverting back to this inconsistency since not all use the same operating system.

Yes, I think that would be a good idea.

I didn't know about this gitattributes feature. I'll have a look

In any case, I agree we should have some kind of protection. I'll look into what we can do and may some concrete suggestions (unless you'd like to do that :-)

paulmillar commented 2 months ago

Hi @gkoum,

I was thinking we should introduce the protection as a separate step. I've created an issue so we don't forget: #141.