0

When I checkout curl like this:

git clone https://github.com/bagder/curl.git

I get (without doing anything) 2 modified files:

> git status
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:   winbuild/Makefile.msvc.names
    modified:   winbuild/MakefileBuild.vc

no changes added to commit (use "git add" and/or "git commit -a")

Even when I try to checkout these files like this:

git checkout winbuild/Makefile.msvc.names

they are still modified. A call to git diff -R shows that it may be related to line endings, because the diff shows that ^M is appended to each line.

Since it is suggested in the comments, that the problem is related to the .gitattributes file, here it is:

*.dsw -crlf
buildconf eol=lf
configure.ac eol=lf
*.m4 eol=lf
*.in eol=lf

Removing my gitconfig does not change the situation, so I guess it is not related to that.

I am on ubuntu linux by the way.

Nathan
  • 7,099
  • 14
  • 61
  • 125
  • 1
    Are you using Linux? It's probably a line ending problem. Check `git diff -R` and see if these files are being replaced with [^M at the end of each line](http://stackoverflow.com/questions/1822849/what-are-these-ms-that-keep-showing-up-in-my-files-in-emacs). I expect the [.gitattributes](https://help.github.com/articles/dealing-with-line-endings/) of this repo need to be fixed up. – hineroptera Apr 06 '16 at 20:15
  • @hinerm You seem to be right. I added the relevant information to the question, but I still do not know how to fix this – Nathan Apr 06 '16 at 22:38

1 Answers1

0

There is a second .gitattributes file in the winbuild, that reads:

MakefileBuild.vc eol=crlf
Makefile.msvc.names eol=crlf
Makefile.vc eol=crlf

This lines cause windows-style line endings to be used.

One way of fixing this problem is removing .gitattributes and checking this in to git. Of cause, this removes the original intention of the file.

Nathan
  • 7,099
  • 14
  • 61
  • 125