PS: The title, in case it is changed, is currently “josh: Get the advantages of a monorepo with multirepo setups”
PS: The title, in case it is changed, is currently “josh: Get the advantages of a monorepo with multirepo setups”
(No, git submodules are not it.)
I'd dream of somethong as simple as
git clone --partial foo/bar https://example.com/some.repo.git
And then everything would work normally. git clone https://example.com/some.repo.git:/foo/bar.git
And then everything works normally.This is the kind of talk about monorepos that makes me think they are a bad idea. Why would someone want to maintain a monorepo and then pretend it's not a monorepo? Not only just pretend it isn't, but invest not-insignificant time on the problem of pretending it's not a monorepo?
I am immediately thinking of the horribleness of how some of the (older) javascript frameworks re-invented the back button (and browser history in general) instead of.. ya know, using the browser.
With each project having its own repo, then you have to track the fact that Foobar 2.2 works with baizo 1.6-1.8 but not more recent versions.
Also conceptually it's easier when you are working with the client and the server at the same time, or the two mobile apps, and so on.
Of course people manage without this when the project has stuff that doesn't fit in a software repo (CAD designs, artwork, etc...there's a reason why that POS Perforce survives, for example). Solidworks has its own proprietary RCS that doesn't work with anything else.
IMHO if the project is relatively small (say <500K LoC) a monorepo is almost always the way to go. But with a big project it breaks down.
And it’s less about LoC, and more about the number of files and how much binary stuff you put in your repo (and how often it changes). Git is really bad when binary data is involved.
Git has the facilities to keep monorepos clicking along (shallow clones and sparse checkout) but they aren’t along the “happy path”
Keeps the binaries out of your repo, replacing them with pointers
A typo? You seem to mean that multi-repo is the way to go :)
The same story is true with things like APIs or types where two services need to stay in sync.
They did that because the browser didn't support adding to the history via JavaScript.
But even now that the browser does support adding to the history via Javascript ... is that really just "using the browser"? At some level in many modern web apps back button history is not just the browser. This isn't an ancient thing left behind with old frameworks.
You can update a library and all the downstream projects in a single commit. There's no race condition or caching problem of pulling an update without pulling/seeing the dependency update. You don't need to wait for dependency artifacts to build and propogate.
You can create a turn key build script that will build the world from source. You can skip any local artifact storage like Artifactory. You don't need to pull multiple repos in a serial fashion, no dependent pulls. You can structure your codebase such that if you pull one commit it can have no other dependencies.
The draw back is Git happens to not make it easy to pull just one folder. Other things like Perforce make it trivial.
I am not affiliated with the project.
JOSH claims to be reversible, so it could be used in either direction, which is where the multiple use cases come in. Treating subsets of a repo as their own repo, or treating multiple repos as one. I would say there is some application overlap between this and git submodule/subtree/subrepo and also tools like copybara.
As an example, Chromium [0] is a non-AOSP project that also uses repo.
[0] https://chromium.googlesource.com/chromiumos/docs/+/HEAD/dev...