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 `mr.post-clone.*` 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@30b0d49 
 and jwhitley/vcsh-root@3dc9057 
 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 
`root.post-clone-retired.00-clone-child-repos`?  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 bootstrap.sh* to test bootstrap changes vs. the 
existing remote `master` branch.

[4] https://github.com/jwhitley/vcsh-root/blob/master/Vagrantfile 
[5] https://github.com/jwhitley/vcsh-root/blob/bootstrap/Vagrantfile 

vcs-home mailing list

Reply via email to