Wireshark-dev: Re: [Wireshark-dev] Git and line endings
From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Tue, 4 Feb 2014 11:27:28 +0000
On 4 February 2014 11:18, Pascal Quantin <pascal.quantin@xxxxxxxxx> wrote:
2014-02-04 Graham Bloice <graham.bloice@xxxxxxxxxxxxx>:


On 3 February 2014 22:50, Pascal Quantin <pascal.quantin@xxxxxxxxx> wrote:
Hi all,

with subversion we were using the native eol-style property. Now that we moved to git, would it make sense to commit a .gitattributes file with text=auto to avoid any issue between Linux and Windows development boxes?
I faced tonight an issue with asn2wrs.py that generated the ASN.1 dissector with CRLF line endings on my Windows machine (due to the use of Python open() function) while my checkout had LF line endings, leading to completely different files from git point of view.


There seems to be a lot of confusion around this aspect, possibly because Windows is usually a second class citizen in the git world.

Some other useful links:

Even when the .gitattributes is correctly set it seems that someone will have to re-normalise the repo (as in the GitHub article).

Yes, I played a bit with .gitattributes after sending my email and could easily shoot me in the foot...
I guess we cannot (should not) expect to have all Windows contributors to set the core.autocrlf=true setting before cloning Wireshark.
Still I do not see any easy solution:
- do one big commit introducing .gitattributes and re-normalising the repo, OR
- put a big fat warning somewhere (in the documentation ?) stating that Windows users should set core.autocrlf=true before cloning, OR
- modify all scripts like asn2wrs.py so that they are less smart and ouput LF line endings (assuming it is possible) and expect peaople that they did not activate autocrlf (sigh...)

Only first option seems good to me (maybe there is a 4th option that I missed?).
I just did a dry run and following the re-normalize procedure described on github only wireshark.sln file is impacted so it is not a massive commit.
If there is a consensus I will do the change.



I know others differ, but IMHO the wireshark.sln file could be deleted anyway. If the re-normalisation isn't too bad then go for that.

I'm a bit confused by the asn2wrs issues though.  If they produce the platform specific line endings for their output, then won't those be normalised by git on commit (if the correct settings for git are applied)?