Another approach to vcsh hook/sparse checkout setup

John Whitley whitley at
Wed Jul 8 02:11:01 CEST 2015

I just landed an update for my homedir repos that enables the use and bootstrapping of vcsh hooks.  This in turn enables sparse checkouts (e.g. for keeping per-repo README files out of $HOME) and other custom repo settings (esp. `git config pull.rebase true`).

I posted in a GitHub issue thread with some related discussion: <>

I’ve replicated the comment below, slightly reformatted for email, since I recall there are folks with limited bandwidth who may not want to hit GitHub and/or for discussion here.

— John


I *finally* went through the setup of vcsh hooks and sparse checkout for my setup.  I took a slightly different route than @vdemeester and @marklee77.  Instead of loading up the bootstrap script with the hooks that must be run on the "root" repo, I use some extra `*` style symlinks to ensure that my root repo (which vcsh knows as `mr` for historical reasons) gets everything run on it the first time out.  See jwhitley/vcsh-root at 30b0d49 <>[1], and jwhitley/vcsh-root at 3dc9057 <>[2] for examples.

The nice thing about this approach is that the bootstrap script takes on only a one line change[3], to do the retroactive sparse checkout cleanup: `vcsh mr read-tree -md HEAD`.  After that, the hooks are all in place and `mr update` invokes vcsh on the remaining child repos correctly.

If I ever got too many hooks in place, it'd be easy enough to run `vcsh upgrade mr` in the bootstrap script and remove the extra `mr.*` symlinks.

It'd be interesting to bake out a simplified vcsh-only demo root repo that incorporates just (e.g.) the `core.sparseCheckout` and the `pull.rebase` settings.  It's a little unclear how to best do this: maybe just `vcsh clone` a whole list of repos in the bootstrap script or maybe in ``?  vcsh itself doesn't have a concept of available-but-uncloned repos AFAICT; that's been mr's job in setups like mine.

Last but not least, hat tip to @marklee77 for having a Vagrantfile around and using sparse checkout to ignore it.  Brilliant, and I've adopted that in slightly different forms in the `master`[4] and `bootstrap`[5] branches' Vagrantfiles.  The `master` version uses an inline-modified bootstrap script to clone the *local* repo into the VM's homedir for testing.  The `bootstrap` version uses the *local* to test bootstrap changes vs. the existing remote `master` branch.

[1] <>
[2] <>
[3] <>
[4] <>
[5] <>

More information about the vcs-home mailing list