RFC: Sparse checkout improvements (was: Re: question (possibly) on git subtree/submodules)
- From
Marc Branchaud <marcnarc@xiplink.com>
- Date
- Jul 27, 2010, 14:24 UTC
- Message-ID
- <4C4EEC0D.2070105@xiplink.com>
- In-Reply-To
- <m3bp9tks6e.fsf@localhost.localdomain>
On 10-07-27 08:48 AM, Jakub Narebski wrote:
Show 14 quoted lines
> Alex <ajb44.geo@yahoo.com> writes: > >> Chris Packham <judge.packham <at> gmail.com> writes: >> >>> The short answer is no. Nothing git has currently will let you clone a >>> subset of files. >> >> Isn't that what 'sparse checkout' does? >> (http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html#_sparse_checkout) > > No, 'sparse checkout' is only about checkout, i.e. the working area. > You still have all objects in repository, only part of tree (part of > project / repository) is not checked out, not present on disk as > files.
There's no such thing as a "sparse fetch" but you can do something like
git clone -n git://there/foo.git cd foo
then
git checkout origin/<branch> -- <paths...>
or git config core.sparseCheckout true [ Add paths to .git/info/sparse-checkout ] git checkout <branch>
but it's fairly inconvenient for day-to-day work. Also, putting a .git/info/sparse-checkout file in a public repo seems of limited use.
So IMHO the current sparse-checkout feature is pretty bare-bones and could use some meat. Here's some thoughts:
* What's missing is a way to define named collections of paths
("sparse-sets?") in .git/info/sparse-checkout, so that you can conveniently
checkout a particular subset of the working directory. It would also be nice
to switch between different sparse-sets.* It would also be good to have a way for a repo to define a default sparse-set, so that a clone would only checkout that default.
* I also think that core.sparseCheckout should be true by default, and git should impose no sparseness if .git/info/sparse-checkout is missing or empty.
Comments?
M.