[Git] Refactoring/Move changes line separator

Answered

Hello community,

during a code review we have found some unexpected changes in some moved java files - but not all of the moved files.

These changes removed the whole content and added the same content. Thus, the whole content of this file was changed in this commit.
Looking in the diff view in intellij it says "Contents have differences only in line separators", which explains why everything is removed and added.

However, I dont understand, how I got there.

In intellij, the original file at its original location is shown with CRLF (I am using windows).
I moved this file with Intellij refactoring/move into another module, keeping the package structure.
Intellij still reports CRLF as line ending for this file.
Thus, in the commit view, the file is marked as moved and "contents are identical". Everything as expected.
However, after submitting the commit and showing the diff the differences are "Contents have differences only in line separators".

Moving the file with git mv on the git bash leads to the expected result (file moved, no changes of the content).
Worth to mentioned that another file at the same location moved to same target location does not cause this issue.

I think it might be an issue in intellij. 

Any ideas how to investigate this?

Thank you in advance,

Stefan

 

0
1 comment

Is there anything specific to the files that are modified vs nono-modified? Language, extension, etc?

Do you have .gitattributes in the project?

What is the git config core.autocrlf setting?

0

Please sign in to leave a comment.