4

Having just cloned this, the directory immediately has changes in it?

I have never encountered something like this and I am curious why this is happening? and how this is even possible?

UPDATE:

I cloned the repo using git clone git://github.com/horndude77/open-scores.git and imediately after running git status reveals:

git status
# Not currently on any branch.
# 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:   SaintSaensRomanceOp36/defs.ily
#       modified:   SaintSaensRomanceOp36/horn.ily
#
no changes added to commit (use "git add" and/or "git commit -a")

git diff reveals:

warning: CRLF will be replaced by LF in SaintSaensRomanceOp36/defs.ily.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in SaintSaensRomanceOp36/horn.ily.
The file will have its original line endings in your working directory.
diff --git a/SaintSaensRomanceOp36/defs.ily b/SaintSaensRomanceOp36/defs.ily
index 07e09ac..c7961be 100644
--- a/SaintSaensRomanceOp36/defs.ily
+++ b/SaintSaensRomanceOp36/defs.ily
@@ -1,47 +1,47 @@
-\version "2.13.13"
.
.
.

NOTE: only the top of the diff is included as it was very long.

Is it removing the CRLF characters when I clone the repository and if so how were these ever included in a commit to bigin with?

rudolph9
  • 8,021
  • 9
  • 50
  • 80

2 Answers2

5

The CRLF characters included when the commit was made on a windows machine are automatically removed when the repository is cloned. Git then detects this change and hence the repository is modified right after cloning with the user having done anything other than a git clone.

I fixed this by removing * text=auto from my .gitattributes file.

rudolph9
  • 8,021
  • 9
  • 50
  • 80
2

This is a problem with differences between Windows and Linux. There is a stack overflow question addressing this problem.

You can fix it simply by doing:

$ git config core.autocrlf true
Community
  • 1
  • 1
Whitecat
  • 3,882
  • 7
  • 48
  • 78
  • 1
    Questions about the the original question should be submitted as a comment. – rudolph9 Jun 06 '12 at 03:03
  • Thank you for your constructive comment I will do that in the future. I have edited the answer to remove the question. – Whitecat Jun 15 '12 at 23:01
  • 1
    This still does not answer the question, the question was asking what was the cause, not how to check for changes. – rudolph9 Jul 22 '12 at 18:19
  • You are right. I cleared up the solution more. I also added a link to a stackoverflow post that answers your question. – Whitecat Jul 31 '12 at 22:53
  • If the question is a duplicate you should flag it as such, _not_ submit that as an answer. – rudolph9 Aug 01 '12 at 00:05