4 ms·
With submodules you end up doing this dance where you have to do the following steps in order to make a change: 1) Create a PR in the submodule with your chang
by actinium226 2y ago
With submodules you end up doing this dance where you have to do the following steps in order to make a change:
1) Create a PR in the submodule with your changes and create a PR in the main repo with the submodule hash replaced with the one in the 1st PR
2) Merge the submodule PR (now the main repo is pointing at an out of date hash in the submodule)
3) Go back to the main repo PR, update the hash, rerun tests, merge it (assuming tests pass)
It often feels burdensome, particularly when you need to change a single line of code in the submodule. It invites race conditions when multiple people work on the submodule simultaneously (so in step 3 above your tests might not pass because somebody else merged something into the submodule repo in between 1 and 2). It also creates weirdly ambiguous situations like what if someone updates the documentation in the submodule - do you update the main repo, or do you simply allow the main repo to lag behind the submodule's master branch?
- fwip 2y agoI haven't used submodules much (just one project for a few years), but the only flow that seemed to work is "never commit changes in the submodule." You can change the code locally on-disk for testing, then submit your changes to upstream. Once you've got an upstream ref (preferably after merge), then you can update the submodule to match. This does slow everything down though, unless you're cleverer about CI and deployment than we were (very possible).
- IshKebab 2y agoI think you're conflating submodules with vendoring.
- fwip 2y agoThat's one way to describe our strategy, yeah. We used submodules technically to basically vendor our dependencies. Our "upstream" was other people in the same org with whom we had a good working relationship, so our patches generally got merged within a day or two.
- IshKebab 2y agoI agree, and that's annoying, but it's a different problem.