4

I am using git 1.7.1 on Windows XP with cygwin. The issue can be best illustrated by example:

$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   system/application/config/email.php
#       modified:   system/application/config/upload.php
#       modified:   system/application/views/frontend/business_subscription/start_subscription.php
#
no changes added to commit (use "git add" and/or "git commit -a")

$ git checkout system/application/config/email.php

$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   system/application/config/email.php
#       modified:   system/application/config/upload.php
#       modified:   system/application/views/frontend/business_subscription/start_subscription.php
#
no changes added to commit (use "git add" and/or "git commit -a")

$ git diff -w

Git shows that there are some changes in the listed files but I cannot get rid of the changes- the file is still there. It seems that it only happens to files where there are no changes other than whitespace (because git diff -w does not output anything.

I think this might be caused by git's crlf settings, but I am not sure about it.

fest
  • 1,425
  • 12
  • 17

1 Answers1

4

Any checkout file which result in a content (in the "working directory", i.e. directly in your disk as a file) different from the index mean some kind of "automatic content transformation" just took place.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • 1
    It seems that the problem was indeed caused by core.autocrlf When I set it to false the changes did not appear there. I guess it's time to convert the whole repository and my development team to use consistent newline characters. – fest Aug 24 '10 at 20:56
  • @fest: yes, that is the idea. See also http://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code/2354278#2354278 – VonC Aug 24 '10 at 20:57