1

My Eclipse plugin stores project-specific preferences in org.myplugin.ide.eclipse.core.prefs, which contains multiple preferences as key-value-pairs. I want to put some of these preferences under version control and ignore others. To do this, I would have to split the file into two files. Is that possible? In case it is: how?

FYI: The plugin is the Sonar Eclipse Plugin.

Marco Eckstein
  • 4,448
  • 4
  • 37
  • 48

1 Answers1

0

You should:

  • not version the org.myplugin.ide.eclipse.core.prefs file at all
  • version only the values you are interested in in a separate "value file"
  • version a script able to modify the org.myplugin.ide.eclipse.core.prefs file it founds, changing the right lines with the data from the versioned "value file".
    That would restore the org.myplugin.ide.eclipse.core.prefs file with the value you expect to see (and which are versioned in said "value file")

You can do that automatically in git with a content filter declared in a .gitattributes file:

content filter

On checkout, the script registered in that .gitattributes will look for a org.myplugin.ide.eclipse.core.prefs file and perform the necessary value adjustments.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250