XF 2.0 Safe to .gitignore _metadata.json?

Jake B.

Well-known member
Long story short, _metadata.json is causing a lot of extra time to be wasted when merging changes between multiple developers.

I've done some basic testing, and it seems like it'd be save to add _metadata.json (for dev/design mode) to our .gitignore. From my basic amount of testing it seems like these are automatically rebuilt if they don't exist, and are only used to check if a template/style property/whatever needs to be reloaded from the dev output, and if the file doesn't exist it appears to be reloading it regardless. We have an add-on we use internally that allows us to automatically run xf-addon:rebuild (or xf-addon:upgrade when necessary) and xf-designer:import on every installed add-on and style at once, and it's just a part of our git flow that when you pull you should run this after merging to make sure your local environment is as updated as possible. Obviously with add-ons sometimes you'll need to run some upgrade/install step manually. So I'm just hoping we'd be able to save some headache while merging by removing these _metadata.json files since they just contain hashes and you sometimes have to go through hundreds of lines to manually merge them if git isn't able to handle it for one reason or another :)
 
Thing is, they don't just contain hashes. They contain versions too for phrases and templates.

What exactly is the issue? Obviously we have three developers here and it doesn't pose a particular problem.

What you don't want is for template and phrase versions to be wrong, because it is that which dictates how templates and phrases are handled in terms of being outdated.

I think, ideally, you need to try and work out how to maintain it better accurately between you.
 
Thing is, they don't just contain hashes. They contain versions too for phrases and templates.

Ah right, didn't think of that

What exactly is the issue? Obviously we have three developers here and it doesn't pose a particular problem.

It's obviously not a huge issue, and it only takes a few seconds to fix but it seems with nearly every push someone does git has issues merging these files due to the hashes (mainly if two people have edited that template in around the same time and don't have the other person's updates already). Will just deal with it as it is currently, like I said it's not a huge thing was just hoping for a quality of life improvement :p
 
If you do an update and the files have been merged, e.g. a modified template has been merged with an incoming template then the command xf-dev:sync-templates is your friend.

It will force the template to be updated to the database and output the new (correct) hash and version.

It can be tricky but resolving that conflict is worth the time especially if it keeps the version correct.
 
Is style_properties.less safe to gitignore? not sure if it's used for anything other than editor hints, and it's probably getting merge issues in git more often than the metadata files do
 
Cool, thanks. Just wanted to make sure it wasn't being used somewhere else that I hadn't tracked down :)
 
Back
Top Bottom