1

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.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
Denis
  • 1,167
  • 1
  • 10
  • 30
  • Git can't commit something that doesn't have a change in content. Is someone else removing these files from the repository? Is it possible that this has to do with the line endings issue for Linux vs. Windows? – Thomas Kelley Nov 14 '13 at 06:30
  • Why are those files removed? Do you really want those files under version control? Why do you commit the deletion of those files? (If you do not commit deletion, git will not even notice that they where missing in between.) – michas Nov 14 '13 at 07:04
  • Thanks! EGit automatically (without commit) removed these files from the repository! The files are generated by EMFText. Actually everyone who have EMFText installed could regenerate them. But some peolpe doesn't have EMFText. – Denis Nov 14 '13 at 07:57
  • If the content hasn't changed the commit is free, what's the concern here? – jthill Nov 14 '13 at 08:18

2 Answers2

2

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.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
1

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' ' ')
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250