Git showing files are changed, but content hasn't changed [message #1860997] |
Wed, 13 September 2023 13:52  |
Eclipse User |
|
|
|
Hello, I am using Renesas E2Studio. I have used Git clients in other toolsets, but this one is giving me some strange behavior. Frequently, especially after a merge or a branch switch, it will show files have unstaged changes. However, there are no changes. It is not related to whitespace characters, I've confirmed that the terminators are CRLF. Trying to compare with the head revision shows no differences, and trying to replace with the head revision cannot get rid of the unstaged changes. We do have core.filemode set false, so it does not seem to be related to file permissions.
I did have a previous problem where files were mysteriously becoming converted to Unix format (LF instead of CRLF), for which we added a .gitattributes file:
* text=auto
*.c text eol=crlf
*.h text eol=crlf
*.cproject text eol=crlf
*.gitignore text eol=crlf
*.project text eol=crlf
*.ld text eol=crlf
*.xml text eol=crlf
That took care of the problems with source files changing format, but we have this problem where we might do a merge, and it will show hundreds of files have changed, but most of them are exactly the same. Any ideas on how to fix this?
|
|
|
|
|
|
|
|
|
|
|
Re: Git showing files are changed, but content hasn't changed [message #1861189 is a reply to message #1861184] |
Wed, 27 September 2023 08:49   |
Eclipse User |
|
|
|
I think I found what's causing all this strange behavior, but this was to correct something else. I created a separate project, created a git repository, and started playing around with it trying to reproduce these strange cases where I commit on one branch, switch to another, and it flags files as different. It wouldn't do it. So I added the .gitattributes file we created for the main project a while back, and now I have problems.
*.c text eol=crlf
This is making things behave strangely. Now when I do a commit on one branch and switch to another, it's very consistently showing that files are different, but if you do a comparison, it shows no difference. We had added the .gitattributes a while back because whole files were mysteriously converting to LF endings when we're using CRLF. So, what am I doing wrong?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.13502 seconds