Does anyone know of a way to get numerous “read-only” git repositories based off of hard-links? In otherwords, I want subsequent working dirs off of a ~500MB repo to only be hardlinks thus making it just a few KB.
Short of that, any any feedback on my below insanity is appreciated.
Okay, now background:
I’m working on building a QA tool where I want to be able to hit:
1f381de1.somesite.com
9e010d42.somesite.com
...etc
As these projects include dynamic (e.g. php) files hosted by, for example, apache, I can’t pipe all the output through something like git show, or I happily would (if anyone knows a possible way to do this, I’d love to hear it).
I don’t want to do a git clone or git-new-workdir for each version I want to hit as I’ll be copying all the live files in the repo. As I don’t want to constantly garbage-collect this project there may be a hundred versions or more “active” at one time and I don’t want to copy what may be a ~500MB project 100 times.
So ideally some tool exists that allows me to get several read-only checkouts based on hardlinks. If not, my current thinking is:
- Checkout the repository
- make an “uncompressed objects” folder
- unpack the
.packfile if necessary
- I want a new version:
- make directory
- uncompress the commit log for the tree with
git catfile -p - uncompress each object into the “uncompressed objects” folder (if it doesn’t already exist)
- walk up tree as necessary, repeating the above step
- create hardlinks in my new folder to each uncompressed object
The ultimate result is that I have an uncompressed version of all the files I use in .git/objects with every file in a new checkout being a hardlink pointing at some file in that directory.
Looking into this, I ran across FUSE which I’ve heard about but never really used or bothered to wrap my head around what it really was. It allows me to do what I thought was impossible — proxy
git showcommands to OS-level requests for files.