Line endings in Git repo
Feb 24, 2019
asked by anonymous
Question / Issue:
Can you explain your use of line endings in the privateisland repo. I'm seeing ^M show up when running 'git diff'
Responses:
Date: Feb. 24, 2019
Author: Mind Chasers
Comment:
Unfortunately some of the source files currently have CRLF line endings and some have LF line endings, but we are moving towards having all files in the repo with LF line endings only since we recognize that some developers will work on Windows (CRLF) and others will work on Mac/Linux (LF).
There were some source files with mixed line endings, but we think this was resolved with commit 06aea3c5.
On Mac and Linux, we're using the following git config: core.autocrlf=input
On Windows, we have it set to core.autocrlf=true, which should convert line endings properly on checkout and commit.
We use the common command line tools hexdump and file to determine the line endings in our files:
$ hexdump top.v | more
0000000 2f 2a 0a 2a 20 20 20 20 20 20 20 74 6f 70 2e 76
...
You can see that the line ending is 0a, which is a LF
$ file top.v
top.v: ASCII text, this tells us that the file is consistent and each line ends with a LF
We also use these tools on Windows under a CygWin environment / bash shell.
We're in the process of updating our article regarding Git and Lattice Diamond and will cover this issue in more detail: https://mindchasers.com/dev/tools-diamond-git