Re: RFC: Design and code of partial clones (now, missing commits and trees OK)
From: Junio C Hamano <hidden>
Date: 2017-09-19 05:52:02
Jonathan Tan [off-list ref] writes:
For those interested in partial clones and/or missing objects in repos,
I've updated my original partialclone patches to not require an explicit
list of promises. Fetch/clone still only permits exclusion of blobs, but
the infrastructure is there for a local repo to support missing trees
and commits as well.
...
Demo
====
Obtain a repository.
$ make prefix=$HOME/local install
$ cd $HOME/tmp
$ git clone https://github.com/git/git
Make it advertise the new feature and allow requests for arbitrary blobs.
$ git -C git config uploadpack.advertiseblobmaxbytes 1
$ git -C git config uploadpack.allowanysha1inwant 1
Perform the partial clone and check that it is indeed smaller. Specify
"file://" in order to test the partial clone mechanism. (If not, Git will
perform a local clone, which unselectively copies every object.)
$ git clone --blob-max-bytes=100000 "file://$(pwd)/git" git2
$ git clone "file://$(pwd)/git" git3
$ du -sh git2 git3
116M git2
129M git3
Observe that the new repo is automatically configured to fetch missing objects
from the original repo. Subsequent fetches will also be partial.
$ cat git2/.git/config
[core]
repositoryformatversion = 1
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = [snip]
fetch = +refs/heads/*:refs/remotes/origin/*
blobmaxbytes = 100000
[extensions]
partialclone = origin
[branch "master"]
remote = origin
merge = refs/heads/masterThe above sequence of events make quite a lot of sense. And the following description of how it is designed (snipped) is clear enough (at least to me) to allow me to say that I quite like it.