4 ms·
They're using git as a cache. Having generated files stored there means they're available if they're needed (eg in CI) without needing further access controls,
by onion2k 4y ago
They're using git as a cache. Having generated files stored there means they're available if they're needed (eg in CI) without needing further access controls, they're versioned, and it's a simple and understandable strategy. As the article states, most devs are set up to ignore those files so they're not much of a source of the slowness. It's a common pattern for apps that have to serve lots of different locales.
- fomine3 4y agoI don't think it's good idea to store cache in Git. Any file remains forever in the repository after once committed. Local/remote repository become unnecessary big.
- kadoban 4y agoThe bigger issues for me are it makes history impossible to read (every change is hidden in an avalanche of crap), merges are a mess (you definitely want to spend forever merging autogened files, right?), PR reviews are annoying, etc.
- Gigachad 4y agoDepends how much generated stuff is there. We have our graphql schema in git even though its auto generated via a library. But its useful in PRs to see exactly how the schema changed as a result of the root change.
- kadoban 4y agoYeah if there's not a lot of it, and if it's easy to regenerate, it can be fine.
- _ikke_ 4y agoYou may want to set the '-diff' attribute for these files so that git will not show diffs for these, instead it will show 'Binary files differ'. There is also '-merge', which will cause git to not attempt to merge the contents, but just ask you to pick a side. The challenge however is then verifying the contents of these files in things like merge requests. See https://gitirc.eu/gitattributes.html https://gitirc.eu/gitattributes.html
- robertlagrant 4y agoIt's still surprising to have any generated things there. E.g. you could make the same case for keeping built binaries in Git as well. Is there a reason why that type of file couldn't be better place into an artifact repository, or just generated and consumed in CI as part of generating a final build output?
- kstenerud 4y ago> place into an artifact repository This adds yet another moving part to the system, and another place things can go wrong. > generated and consumed in CI as part of generating a final build output This can get quite slow, and on larger projects you have to expend a lot of effort to keep build times reasonable. Also, if you're serving a library for public consumption, you generally don't want to add the burden of extra build steps for the user to follow before they can use it. If it can all be automated to the point of invisibility to the user that's fine, but often it can't.
- arinlen 4y ago> It's still surprising to have any generated things there. E.g. you could make the same case for keeping built binaries in Git as well. This is not surprising at all. In fact, it's quite standard to commit string translations. Just because you can run the code generation/string replacement step as part of the build that does not mean it's a good idea to generate everything from scratch at every single build. String translations hardly change once they are introduced, running the build step takes significant amounts of time, and if anything fails then your product can break in critical and hard to notice ways.
- robertlagrant 4y agoI'm not saying don't have the translations at all. I'm saying: 1) caching things in git in general is a bad idea; why is it not in this case? 2) these are not - to my understanding - the raw resource files, but rather machine-generated intermediate files. This is why it's about caching, rather than minimal source files. Additionally, to respond to your comment, if string translations don't change much then it may be possible to push them out as an internal 3rd-party library, and then they're even quicker to build.
- haizzz 4y agoSorry I've been a bit misleading. These xlf files aren't generated, they're just not interacted with by engineers but they're still created and edited by humans as translations. We want to keep track of them so that if we deploy a different commit, the texts and translations in other languages will match