Question

Some files in my project are deleted and recreated often enough. Git treats them like a completly new files and commits them as new even if the contents of the files isn't changed. Is it possible to ignore file recreation and handle them as a usual, not recreated files?

I've set core.trustctime to false, but nothing is changed.

PS: I'm using Github for Windows.

Was it helpful?

Solution

This is a bug in Eclipse that won't be fixed, unfortunately (it's from 2002).

What happens is this: Eclipse has an object to track files in the workspace. They have defined the usual operations like create and delete. So what happens is that you build your project.

This triggers the EMFText builder. It will delete the files which will trigger a "git rm" since Eclipse can't tell the difference between "code generator deletes files to create them again" and "user deleted a file for good."

Then the file is created again. Eclipse has no good way to fell whether you want to have this delete in your commit history or whether this was unintentional. So the file stays in the deleted state.

MercurialEclipse and all other version control plugins on Eclipse are affected as well.

Workarounds:

  1. Create a script which simply adds all files that exist but are in state "delete".

  2. Configure your code generator not to delete files during "Clean". Xtext can do this.

OTHER TIPS

You could try and apply a git update-index assume-unchanged directive on all the files regenerated by EMFText.

See "git update-index --assume-unchanged on directory":

cd /path/to/EMFText/generated/files
git update-index --assume-unchanged $(git ls-files | tr '\n' ' ')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top