peru
peru copied to clipboard
parallelize git submodules
It's annoying when you fetch a git project that has a lot of nested submodules (in particular, the YouCompelteMe vim plugin), because submodule fetching is done in series. It would be nice if all the submodules could be fetched in parallel, just like regular peru modules.
One solution would be to implement some kind of channel to let the plugins give commands back to peru. That would be much more complicated than the current plugin API, and it's almost certainly not what we want. However! a better idea might be to have the git plugin optionally suppress submodules and autogenerate a peru.yaml
file. Peru would then be able to fetch the submodules itself without any change to peru core!
The main downside to this approach would be that this magical peru.yaml
file would appear among module's files. There could be a few ways to work around that:
- Allow modules to supply peru metadata out of band, a la
PERU_REUP_OUTPUT
. (This would have to be passed around somehow along with the module's tree, which would be a pretty big change.) - Define a filename besides
peru.yaml
that can be used for output, like.hidden.yaml
or something. Maybe suppress this file magically when writing out trees. (This would be a lot of magic.) - Simply accept that if the user specifies the
autogenerate peru stuff: [filename]
flag, then they're either willing to see[filename]
in the output, or they're willing to specify additional fields likepick
to get rid of it. (This is my preference right now.)
Thought the second: If this is even an option for the git plugin, maybe it should be the default? It would be impossible to discover for most people.
Coming back to this in the future: Unlikely to be a safe default. This would be hard to discover, but the people who need it would have a strong incentive to discover it :)
Major update: it looks like a --jobs
flag is coming out in git 2.9. Could be useful to set that by default where it's supported. It might be difficult to make that play nicely with the job control that peru tries to do, but speed is probably more important to submodule users than perfect control is.