Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Git showing files are changed, but content hasn't changed
Git showing files are changed, but content hasn't changed [message #1860997] Wed, 13 September 2023 13:52 Go to next message
Eclipse UserFriend
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 #1860999 is a reply to message #1860997] Thu, 14 September 2023 01:53 Go to previous messageGo to next message
Eclipse UserFriend
It's it possible that someone has committed crlf to the actual git repository? I know that causes nasty problems and it's hard to fix using the tools. To fix in one needs to check out the repository without doing crlf conversion and then convert any files with crlf to just use lf and commit those back...
Re: Git showing files are changed, but content hasn't changed [message #1861018 is a reply to message #1860999] Thu, 14 September 2023 09:22 Go to previous messageGo to next message
Eclipse UserFriend
All of the source files are committed with CRLF, as we've been doing for years. I'm confused, why would this now be causing a problem?
Re: Git showing files are changed, but content hasn't changed [message #1861025 is a reply to message #1861018] Thu, 14 September 2023 10:53 Go to previous messageGo to next message
Eclipse UserFriend
I only work on projects where people work on Linux, Mac, and/or Windows and there it's important for the folks on Windows not to commit Windows line endings. In the end, it's hard to say what exactly problem you are having from just your description... Sorry...
Re: Git showing files are changed, but content hasn't changed [message #1861027 is a reply to message #1861025] Thu, 14 September 2023 11:18 Go to previous messageGo to next message
Eclipse UserFriend
We're only using Windows and our server where the repositories are kept is also Windows, so it's even more mysterious why the tools seemed to be converting them.
Re: Git showing files are changed, but content hasn't changed [message #1861117 is a reply to message #1861027] Thu, 21 September 2023 09:35 Go to previous messageGo to next message
Eclipse UserFriend
Any ideas on this? I recently switched branches on a project, and noticed that every file I modified in one branch is now showing they are different when I switch to the other branch. The files reverted to the unchanged version in the branch, and Git is reporting there is no difference, but it shows they all have uncommitted changes. The file dates changed when I switched branches, but again, there is no content change. How is this supposed to work? The filemode is set for false in the configuration, yet it Git seems determined that the files must be different when only the file dates have changed.
Re: Git showing files are changed, but content hasn't changed [message #1861158 is a reply to message #1861117] Mon, 25 September 2023 08:19 Go to previous messageGo to next message
Eclipse UserFriend
I have confirmed that I can create a new file with exactly the same content with the same filename, and if I replace the file, Git flags it as an unstaged change. How do I get it to disregard the create date change?
Re: Git showing files are changed, but content hasn't changed [message #1861167 is a reply to message #1861158] Mon, 25 September 2023 15:19 Go to previous messageGo to next message
Eclipse UserFriend
What EGit version is installed in that Resenas E2Studio?
Re: Git showing files are changed, but content hasn't changed [message #1861184 is a reply to message #1861167] Tue, 26 September 2023 13:50 Go to previous messageGo to next message
Eclipse UserFriend
It is version 6.3.0.202209071007-r
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 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: Git showing files are changed, but content hasn't changed [message #1861279 is a reply to message #1861189] Tue, 03 October 2023 14:38 Go to previous messageGo to next message
Eclipse UserFriend
See
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/
Re: Git showing files are changed, but content hasn't changed [message #1861355 is a reply to message #1861279] Sat, 07 October 2023 05:49 Go to previous message
Eclipse UserFriend
A little test repository that reproduces the behavior is already a good step. Now there are two more things to do: first, check what happens when you perform the same operation with command-line git. What does git status report? Second, can you make this test repository public, for instance at Github?
Previous Topic:How to manage multiple projects within the same repo
Next Topic:Upgradation to jakarta package in org.eclipse.jgit
Goto Forum:
  


Current Time: Mon May 12 18:39:20 EDT 2025

Powered by FUDForum. Page generated in 0.13502 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top