CRLF vs LF

Post Reply
shadmar
Posts: 25
Joined: Mon Jul 01, 2013 7:28 pm

CRLF vs LF

Post by shadmar »

It's kind of hard when changes are FF into one commit and everything is in the diff like this : https://github.com/pioneerspacesim/pioneer/pull/2365

Would it help if VS owners sat LF as standard ending? :
http://stackoverflow.com/questions/3994 ... s-in-files

It's happened on several commits, maybe my own fault but it's hard to tell.
robn
Posts: 302
Joined: Mon Jul 01, 2013 1:11 am
Location: Melbourne, Australia

Re: CRLF vs LF

Post by robn »

And/or finish testing and merge #2323.

Once we do this then I'd be making a hard rule on it. Any patch that changes line endings gets thrown back. I just had to sort out a huge conflict in WorldView.cpp because of the same thing. master is now in good shape, and we don't want to screw it up again.
Luomu
Posts: 58
Joined: Mon Jul 01, 2013 1:30 am

Re: CRLF vs LF

Post by Luomu »

#2323 fell on the wayside because it started to feel like serious business, and I don't really feel like arguing about line endings. But, we need to do it.

Can someone please try this:

Do a fresh clone of your repo in a temp directory if you don't want to accidentally screw up.

Edit .gitattributes to contain:

Code: Select all

* text=auto

*.dae -text
*.DAE -text
*.obj -text
*.OBJ -text
#no need to worry about pngs etc. text=auto does the right thing.
Then (from git docs):

Code: Select all

rm .git/index  # Remove the index to force Git to
git reset         # re-scan the working directory
git status        # Show files that will be normalized
Status should be:

Code: Select all

#       modified:   AUTHORS.txt
#       modified:   Changelog.txt
#       modified:   Modelviewer.txt
#       modified:   Quickstart.txt
#       modified:   README.txt
#       modified:   contrib/PicoDDS/PicoDDS.cpp
#       modified:   contrib/PicoDDS/PicoDDS.h
#       modified:   contrib/miniz/miniz.c
#       modified:   contrib/miniz/miniz.h
#       modified:   data/fonts/sdf_definition.txt
#       modified:   data/lang/Catala.txt
#       modified:   data/lang/Deutsch.txt
#       modified:   data/lang/English.txt
#       modified:   data/lang/Hrvatski.txt
#       modified:   data/lang/Magyar.txt
#       modified:   data/lang/Russian.txt
#       modified:   data/lang/Spanish.txt
#       modified:   data/models/buildings/kcity/kbuilding01.model
#       modified:   data/models/buildings/kcity/kbuilding02.model
#       modified:   data/models/buildings/kcity/kbuilding03.model
#       modified:   data/models/buildings/vlastan/newbuilding1.model
#       modified:   data/models/buildings/vlastan/newbuilding10.model
#       modified:   data/models/buildings/vlastan/newbuilding11.model
#       modified:   data/models/buildings/vlastan/newbuilding2.model
#       modified:   data/models/buildings/vlastan/newbuilding3.model
#       modified:   data/models/buildings/vlastan/newbuilding4.model
#       modified:   data/models/buildings/vlastan/newbuilding5.model
#       modified:   data/models/buildings/vlastan/newbuilding6.model
#       modified:   data/models/buildings/vlastan/newbuilding7.model
#       modified:   data/models/buildings/vlastan/newbuilding8.model
#       modified:   data/models/buildings/vlastan/newbuilding9.model
#       modified:   data/models/stations/big_crappy_spacestation/big_crappy_spac                                                    estation.model
#       modified:   data/music/README.music.txt
#       modified:   data/ships/dsminer.lua
#       modified:   licenses/GPL-3.txt
#       modified:   win32/uitest/uitest.vcxproj
#       modified:   win32/uitest/uitest.vcxproj.filters
#       modified:   win32/vc2008/perlintest.vcproj
#       modified:   win32/vc2008/pioneer-msvc-9.0.sln
#       modified:   win32/vc2008/pioneer-msvc-9.0.vcproj
#       modified:   win32/vc2008/sbreviewer-msvc-9.0.vcproj
#       modified:   win32/vc2010/Debug.props
#       modified:   win32/vc2010/Libs_Pioneer.props
#       modified:   win32/vc2010/Libs_Thirdparty.props
#       modified:   win32/vc2010/Libs_Thirdparty_Debug.props
#       modified:   win32/vc2010/PreRelease.props
#       modified:   win32/vc2010/Release.props
#       modified:   win32/vc2010/collider/collider.vcxproj
#       modified:   win32/vc2010/collider/collider.vcxproj.filters
#       modified:   win32/vc2010/common.props
#       modified:   win32/vc2010/galaxy/galaxy.vcxproj
#       modified:   win32/vc2010/galaxy/galaxy.vcxproj.filters
#       modified:   win32/vc2010/gameui/gameui.vcxproj
#       modified:   win32/vc2010/gameui/gameui.vcxproj.filters
#       modified:   win32/vc2010/graphics/graphics.vcxproj
#       modified:   win32/vc2010/graphics/graphics.vcxproj.filters
#       modified:   win32/vc2010/gui/gui.vcxproj
#       modified:   win32/vc2010/gui/gui.vcxproj.filters
#       modified:   win32/vc2010/jenkins/jenkins.vcxproj
#       modified:   win32/vc2010/jenkins/jenkins.vcxproj.filters
#       modified:   win32/vc2010/lua.vcxproj
#       modified:   win32/vc2010/miniz.vcxproj
#       modified:   win32/vc2010/newmodel/newmodel.vcxproj
#       modified:   win32/vc2010/newmodel/newmodel.vcxproj.filters
#       modified:   win32/vc2010/pch.props
#       modified:   win32/vc2010/pioneer.sln
#       modified:   win32/vc2010/pioneer.vcxproj
#       modified:   win32/vc2010/pioneer.vcxproj.filters
#       modified:   win32/vc2010/terrain/terrain.vcxproj
#       modified:   win32/vc2010/terrain/terrain.vcxproj.filters
#       modified:   win32/vc2010/text/text.vcxproj
#       modified:   win32/vc2010/text/text.vcxproj.filters
#       modified:   win32/vc2010/ui/ui.vcxproj
#       modified:   win32/vc2010/ui/ui.vcxproj.filters
#       modified:   win32/vc2012/collider/collider.vcxproj
#       modified:   win32/vc2012/galaxy/galaxy.vcxproj
#       modified:   win32/vc2012/gameui/gameui.vcxproj
#       modified:   win32/vc2012/gameui/gameui.vcxproj.filters
#       modified:   win32/vc2012/graphics/graphics.vcxproj
#       modified:   win32/vc2012/gui/gui.vcxproj
#       modified:   win32/vc2012/jenkins/jenkins.vcxproj
#       modified:   win32/vc2012/jobswarm/jobswarm.vcxproj
#       modified:   win32/vc2012/jobswarm/jobswarm.vcxproj.filters
#       modified:   win32/vc2012/lua.vcxproj
#       modified:   win32/vc2012/miniz.vcxproj
#       modified:   win32/vc2012/newmodel/newmodel.vcxproj
#       modified:   win32/vc2012/newmodel/newmodel.vcxproj.filters
#       modified:   win32/vc2012/perlintest.vcxproj
#       modified:   win32/vc2012/perlintest.vcxproj.filters
#       modified:   win32/vc2012/pioneer.sln
#       modified:   win32/vc2012/pioneer.vcxproj
#       modified:   win32/vc2012/pioneer.vcxproj.filters
#       modified:   win32/vc2012/terrain/terrain.vcxproj
#       modified:   win32/vc2012/terrain/terrain.vcxproj.filters
#       modified:   win32/vc2012/text/text.vcxproj
#       modified:   win32/vc2012/text/text.vcxproj.filters
#       modified:   win32/vc2012/ui/ui.vcxproj
#       modified:   win32/vc2012/ui/ui.vcxproj.filters
Yeah, it touches all the text files and vcproj files, because they will be stored as LF but checked out as CRLF. We'll do this once and not worry about it for the next ten years.

You may run into annoying EOL conflicts with your WIP branches. To avoid that, do: git config merge.renormalize true.
shadmar
Posts: 25
Joined: Mon Jul 01, 2013 7:28 pm

Re: CRLF vs LF

Post by shadmar »

This was my result :

Code: Select all

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   AUTHORS.txt
#       modified:   Changelog.txt
#       modified:   Modelviewer.txt
#       modified:   Quickstart.txt
#       modified:   README.txt
#       modified:   contrib/PicoDDS/PicoDDS.cpp
#       modified:   contrib/PicoDDS/PicoDDS.h
#       modified:   contrib/miniz/miniz.c
#       modified:   contrib/miniz/miniz.h
#       modified:   data/fonts/sdf_definition.txt
#       modified:   data/lang/Catala.txt
#       modified:   data/lang/Deutsch.txt
#       modified:   data/lang/English.txt
#       modified:   data/lang/Hrvatski.txt
#       modified:   data/lang/Magyar.txt
#       modified:   data/lang/Russian.txt
#       modified:   data/lang/Spanish.txt
#       modified:   data/models/buildings/kcity/kbuilding01.model
#       modified:   data/models/buildings/kcity/kbuilding02.model
#       modified:   data/models/buildings/kcity/kbuilding02HQ.obj
#       modified:   data/models/buildings/kcity/kbuilding02LQ.obj
#       modified:   data/models/buildings/kcity/kbuilding02MQ.obj
#       modified:   data/models/buildings/kcity/kbuilding03.model
#       modified:   data/models/buildings/kcity/kbuilding03HQ.obj
#       modified:   data/models/buildings/kcity/kbuilding03LQ.obj
#       modified:   data/models/buildings/kcity/kbuilding03MQ.obj
#       modified:   data/models/buildings/kcity/kbuildingHQ.obj
#       modified:   data/models/buildings/kcity/kbuildingLQ.obj
#       modified:   data/models/buildings/kcity/kbuildingMQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding1.model
#       modified:   data/models/buildings/vlastan/newbuilding10.model
#       modified:   data/models/buildings/vlastan/newbuilding10HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding10LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding10MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding11.model
#       modified:   data/models/buildings/vlastan/newbuilding11HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding11LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding11MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding1HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding1LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding1MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding2.model
#       modified:   data/models/buildings/vlastan/newbuilding2HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding2LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding2MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding3.model
#       modified:   data/models/buildings/vlastan/newbuilding3HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding3LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding3MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding4.model
#       modified:   data/models/buildings/vlastan/newbuilding4HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding4LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding4MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding5.model
#       modified:   data/models/buildings/vlastan/newbuilding5HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding5LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding5MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding6.model
#       modified:   data/models/buildings/vlastan/newbuilding6HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding6LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding6MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding7.model
#       modified:   data/models/buildings/vlastan/newbuilding7HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding7LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding7MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding8.model
#       modified:   data/models/buildings/vlastan/newbuilding8HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding8LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding8MQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding9.model
#       modified:   data/models/buildings/vlastan/newbuilding9HQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding9LQ.obj
#       modified:   data/models/buildings/vlastan/newbuilding9MQ.obj
#       modified:   data/models/misc/cargo/cargopod.dae
#       modified:   data/models/misc/error/error.dae
#       modified:   data/models/misc/scale/scale.dae
#       modified:   data/models/misc/test_gun/test_gun.obj
#       modified:   data/models/misc/tombstone/tombstone.dae
#       modified:   data/models/ships/deneb/deneb.dae
#       modified:   data/models/ships/deneb/deneb_collision.obj
#       modified:   data/models/ships/deneb/deneb_low.dae
#       modified:   data/models/ships/deneb/deneb_med.dae
#       modified:   data/models/ships/deneb/deneb_medhigh.dae
#       modified:   data/models/ships/dsminer/DSMinerDecal.dae
#       modified:   data/models/ships/dsminer/DSMinerDecalLOD1.dae
#       modified:   data/models/ships/dsminer/DSMinerGear.dae
#       modified:   data/models/ships/dsminer/DSMinerHatch.dae
#       modified:   data/models/ships/kanara/kanara-low.dae
#       modified:   data/models/ships/kanara/kanara.dae
#       modified:   data/models/ships/kanara/kanara_collision.obj
#       modified:   data/models/ships/lunarshuttle/lunarshuttle_collision.obj
#       modified:   data/models/ships/lunarshuttle/lunarshuttle_gear.dae
#       modified:   data/models/ships/lunarshuttle/lunarshuttle_poly.dae
#       modified:   data/models/ships/lunarshuttle/lunarshuttle_thrusters_lights_labels.dae
#       modified:   data/models/ships/molamola/molamola_1hi.dae
#       modified:   data/models/ships/molamola/molamola_1hi_orig.dae
#       modified:   data/models/ships/molamola/molamola_2med.dae
#       modified:   data/models/ships/molamola/molamola_3low.dae
#       modified:   data/models/ships/molamola/molamola_4col.dae
#       modified:   data/models/ships/natrix/natrix.dae
#       modified:   data/models/ships/natrix/natrix_low.dae
#       modified:   data/models/ships/pumpkinseed/pumpkinseed_1hi.dae
#       modified:   data/models/ships/pumpkinseed/pumpkinseed_2med.dae
#       modified:   data/models/ships/pumpkinseed/pumpkinseed_3low.dae
#       modified:   data/models/ships/pumpkinseed/pumpkinseed_collision.dae
#       modified:   data/models/ships/wave/wave-collision.obj
#       modified:   data/models/ships/wave/wave-mq.dae
#       modified:   data/models/ships/wave/wave.dae
#       modified:   data/models/stations/big_crappy_spacestation/bccoll.dae
#       modified:   data/models/stations/big_crappy_spacestation/bccollpad.dae
#       modified:   data/models/stations/big_crappy_spacestation/bcdecals.dae
#       modified:   data/models/stations/big_crappy_spacestation/bcdocking.dae
#       modified:   data/models/stations/big_crappy_spacestation/bcstation.dae
#       modified:   data/models/stations/big_crappy_spacestation/big_crappy_spacestation.model
#       modified:   data/models/stations/hoop_spacestation/connections.dae
#       modified:   data/models/stations/hoop_spacestation/dockingbay.dae
#       modified:   data/models/stations/hoop_spacestation/dockingpads.dae
#       modified:   data/models/stations/hoop_spacestation/doors.dae
#       modified:   data/models/stations/hoop_spacestation/hoop_docking.dae
#       modified:   data/models/stations/hoop_spacestation/mainhoop.dae
#       modified:   data/models/stations/new_ground/landPad6_docking.DAE
#       modified:   data/models/weapons/missile/missile.dae
#       modified:   data/music/README.music.txt
#       modified:   data/ships/dsminer.lua
#       modified:   licenses/GPL-3.txt
#       modified:   win32/uitest/uitest.vcxproj
#       modified:   win32/uitest/uitest.vcxproj.filters
#       modified:   win32/vc2008/perlintest.vcproj
#       modified:   win32/vc2008/pioneer-msvc-9.0.sln
#       modified:   win32/vc2008/pioneer-msvc-9.0.vcproj
#       modified:   win32/vc2008/sbreviewer-msvc-9.0.vcproj
#       modified:   win32/vc2010/Debug.props
#       modified:   win32/vc2010/Libs_Pioneer.props
#       modified:   win32/vc2010/Libs_Thirdparty.props
#       modified:   win32/vc2010/Libs_Thirdparty_Debug.props
#       modified:   win32/vc2010/PreRelease.props
#       modified:   win32/vc2010/Release.props
#       modified:   win32/vc2010/collider/collider.vcxproj
#       modified:   win32/vc2010/collider/collider.vcxproj.filters
#       modified:   win32/vc2010/common.props
#       modified:   win32/vc2010/galaxy/galaxy.vcxproj
#       modified:   win32/vc2010/galaxy/galaxy.vcxproj.filters
#       modified:   win32/vc2010/gameui/gameui.vcxproj
#       modified:   win32/vc2010/gameui/gameui.vcxproj.filters
#       modified:   win32/vc2010/graphics/graphics.vcxproj
#       modified:   win32/vc2010/graphics/graphics.vcxproj.filters
#       modified:   win32/vc2010/gui/gui.vcxproj
#       modified:   win32/vc2010/gui/gui.vcxproj.filters
#       modified:   win32/vc2010/jenkins/jenkins.vcxproj
#       modified:   win32/vc2010/jenkins/jenkins.vcxproj.filters
#       modified:   win32/vc2010/lua.vcxproj
#       modified:   win32/vc2010/miniz.vcxproj
#       modified:   win32/vc2010/newmodel/newmodel.vcxproj
#       modified:   win32/vc2010/newmodel/newmodel.vcxproj.filters
#       modified:   win32/vc2010/pch.props
#       modified:   win32/vc2010/pioneer.sln
#       modified:   win32/vc2010/pioneer.vcxproj
#       modified:   win32/vc2010/pioneer.vcxproj.filters
#       modified:   win32/vc2010/terrain/terrain.vcxproj
#       modified:   win32/vc2010/terrain/terrain.vcxproj.filters
#       modified:   win32/vc2010/text/text.vcxproj
#       modified:   win32/vc2010/text/text.vcxproj.filters
#       modified:   win32/vc2010/ui/ui.vcxproj
#       modified:   win32/vc2010/ui/ui.vcxproj.filters
#       modified:   win32/vc2012/collider/collider.vcxproj
#       modified:   win32/vc2012/galaxy/galaxy.vcxproj
#       modified:   win32/vc2012/gameui/gameui.vcxproj
#       modified:   win32/vc2012/gameui/gameui.vcxproj.filters
#       modified:   win32/vc2012/graphics/graphics.vcxproj
#       modified:   win32/vc2012/gui/gui.vcxproj
#       modified:   win32/vc2012/jenkins/jenkins.vcxproj
#       modified:   win32/vc2012/jobswarm/jobswarm.vcxproj
#       modified:   win32/vc2012/jobswarm/jobswarm.vcxproj.filters
#       modified:   win32/vc2012/lua.vcxproj
#       modified:   win32/vc2012/miniz.vcxproj
#       modified:   win32/vc2012/newmodel/newmodel.vcxproj
#       modified:   win32/vc2012/newmodel/newmodel.vcxproj.filters
#       modified:   win32/vc2012/perlintest.vcxproj
#       modified:   win32/vc2012/perlintest.vcxproj.filters
#       modified:   win32/vc2012/pioneer.sln
#       modified:   win32/vc2012/pioneer.vcxproj
#       modified:   win32/vc2012/pioneer.vcxproj.filters
#       modified:   win32/vc2012/terrain/terrain.vcxproj
#       modified:   win32/vc2012/terrain/terrain.vcxproj.filters
#       modified:   win32/vc2012/text/text.vcxproj
#       modified:   win32/vc2012/text/text.vcxproj.filters
#       modified:   win32/vc2012/ui/ui.vcxproj
#       modified:   win32/vc2012/ui/ui.vcxproj.filters
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitattributes
no changes added to commit (use "git add" and/or "git commit -a")

F@F-PC ~/pioneer2 (master)
compared with the standing master : https://github.com/shadmar/pioneer/comp ... ...gittest
Luomu
Posts: 58
Joined: Mon Jul 01, 2013 1:30 am

Re: CRLF vs LF

Post by Luomu »

.gitattributtes added and normalization commit done. I don't want to hear the word 'line ending' again.

As mentioned above, the setting git config merge.renormalize true may prove helpful if this causes merge conflicts.
Post Reply