Switch to metadata-less gitfiletree

tl;dr:

  • add "Metadata" : "false" to project root’s .filetree
  • commit the change
  • in every image with the repo: open Monticello Browser, right click on the repository and select Flush cached versions
  • the version & co. files will be automatically removed when you make a change in the package

In detail

GitFileTree now has a metadata-less mode that finally gets rid of those pesky version & co. files that caused merge conflicts more than they should. Plus all the metadata is stored much more accurately by git itself (yay, no more broken ancestry).

To get rid of it, you need to add "Metadata": "false" to your .filetree file in the repository root. Note the double quotes in "false" — it’s a string, not boolean. The file should look something like this.

.filetree
1
2
3
{"packageExtension" : ".package",
"propertyFileExtension" : ".json",
"Metadata" : "false"}

Now commit the change and you should be done… or not.

Pharo caches all those properties, so in every image where you’ve added the repository, you need to open the Monticello Browser, right click on the incriminating package and select Flush cached versions for it to load the modified properties.

Doing the steps above will not get rid of the metadata files, you can either remove them manually, or just let them be — once you make any code change and commit it in Pharo, the metadata (for the given package) will be automatically removed, so you don’t need to worry about them.

All-in-one script

Finally, if you want to be fancy, you can do all the above directly from Pharo.

1
2
3
4
5
6
7
8
9
10
11
MCFileTreeGitRepository allInstances detect: [ :each |
each location includesSubstring: 'graphviz-layout' "a unique part of the repo's name"
] ifFound: [ :repo | |properties|
properties := STON fromString: repo directory / '.filetree'.
properties at: 'Metadata' put: 'false'.
(repo directory / '.filetree')
ensureDelete;
writeStreamDo: [ :stream | stream nextPutAll: (STON toJsonStringPretty: properties) ].
repo gitCommand: #('commit' '-m' 'Switched repository to metadata-less mode.' '--' '.filetree') in: repo directory.
repo flushCache.
]