[z88dk-dev] git issue, line endings maybe?
Posted: Sat Jan 27, 2018 12:03 pm
I work on Linux, and ever since I made my first fork of the z88dk repo 'git status' has told me I've got changed files which I know I haven't touched. For example, right now I have everything up to date, and I see this:
>git status
On branch master
Your branch is up-to-date with 'origin/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: doc/lib3d.txt
modified: doc/ti.txt
modified: examples/clisp/clisp-spec.txt
modified: examples/msx/README
modified: examples/osca/readme.txt
modified: support/Ace/README
modified: support/aquarius/README
modified: support/c128/README
modified: support/cpc/README
modified: support/m5/README
modified: support/nascom/README.TXT
modified: support/sam/README
modified: support/squsq/sq.txt
modified: support/svi/README
modified: support/ticalc/README
modified: support/trs80/cmd2cas.txt
modified: support/vz/README
modified: support/zx/zxbasdrv/readme.txt
I've not touched any of those.
In the past I've just ignored this, but now it's getting in the way. I've been working on something which has taken weeks, and I've done merges to keep up to date with upstream (i.e. z88dk). Now, when I try to get back my stash'ed work git refuses to merge them because it thinks that list of changes above is going to get lost. It tells me to stash or commit them, but if I try that, even immediately afterwards it thinks those files are still changed.
I *think* this is something to do with line endings. 'git diff' shows the entire file content has changed, even though the lines are identical on each side of the diff. I occasionally see this sort of warning:
>git diff doc/lib3d.txt
warning: CRLF will be replaced by LF in doc/lib3d.txt.
The file will have its original line endings in your working directory.
...
I can see in a hexdump that the file has Windows line endings - 0d 0a. So I think git is trying to tell me that if I commit the file it will change the line endings to Linux style - 0a. I don't want it to do that. I just want it to leave such files alone. So I've read everything I can find on git's "core.autocrlf" config, and have tried setting:
git config --global core.autocrlf input
which is recommended for Linux users, and then rebuilding the index, etc. Nothing I've tried has made any difference.
I notice that all the other files in the repo, other than the ones listed above, have Linux style line endings. These ones are different for some reason. How are other devs dealing with this? Is there some magic git setting or work flow which gets around the problem?
I'm not sure what to do. I can't get rid of the warnings, git thinks files are changed when I've not been near them, and I can't unstash my changes because it won't merge. Help!
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>git status
On branch master
Your branch is up-to-date with 'origin/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: doc/lib3d.txt
modified: doc/ti.txt
modified: examples/clisp/clisp-spec.txt
modified: examples/msx/README
modified: examples/osca/readme.txt
modified: support/Ace/README
modified: support/aquarius/README
modified: support/c128/README
modified: support/cpc/README
modified: support/m5/README
modified: support/nascom/README.TXT
modified: support/sam/README
modified: support/squsq/sq.txt
modified: support/svi/README
modified: support/ticalc/README
modified: support/trs80/cmd2cas.txt
modified: support/vz/README
modified: support/zx/zxbasdrv/readme.txt
I've not touched any of those.
In the past I've just ignored this, but now it's getting in the way. I've been working on something which has taken weeks, and I've done merges to keep up to date with upstream (i.e. z88dk). Now, when I try to get back my stash'ed work git refuses to merge them because it thinks that list of changes above is going to get lost. It tells me to stash or commit them, but if I try that, even immediately afterwards it thinks those files are still changed.
I *think* this is something to do with line endings. 'git diff' shows the entire file content has changed, even though the lines are identical on each side of the diff. I occasionally see this sort of warning:
>git diff doc/lib3d.txt
warning: CRLF will be replaced by LF in doc/lib3d.txt.
The file will have its original line endings in your working directory.
...
I can see in a hexdump that the file has Windows line endings - 0d 0a. So I think git is trying to tell me that if I commit the file it will change the line endings to Linux style - 0a. I don't want it to do that. I just want it to leave such files alone. So I've read everything I can find on git's "core.autocrlf" config, and have tried setting:
git config --global core.autocrlf input
which is recommended for Linux users, and then rebuilding the index, etc. Nothing I've tried has made any difference.
I notice that all the other files in the repo, other than the ones listed above, have Linux style line endings. These ones are different for some reason. How are other devs dealing with this? Is there some magic git setting or work flow which gets around the problem?
I'm not sure what to do. I can't get rid of the warnings, git thinks files are changed when I've not been near them, and I can't unstash my changes because it won't merge. Help!
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot