jelmer / dulwich

Pure-Python Git implementation
https://www.dulwich.io/
Other
2.06k stars 395 forks source link

Sparse Checkout #405

Open meatballs opened 8 years ago

meatballs commented 8 years ago

Implement the sparse checkout functionality described at: http://schacon.github.io/git/git-read-tree.html#_sparse_checkout

i.e. if config.core.sparsecheckout = true, then only checkout files which match the patterns listed in the file .git/info/sparse-checkout

meatballs commented 8 years ago

How about the following:

meatballs commented 8 years ago

I'm happy to pick this one up once we agree on the way forward!

jelmer commented 8 years ago

On Fri, Jan 15, 2016 at 01:57:27AM -0800, Owen Campbell wrote:

How about the following:

  • Add list parameters match_patterns and ignore_patterns to index.build_index_from_tree which can be used to pass unix style file pattern matches. The parameters would have a default value of None The syntax of these is the same as for gitignore files. I would suggest passing in a Matcher object which can be constructed from a .gitignore or .git/info/sparse-checkout file.
  • Create a new file path validator which uses the fnmatch module to match against the pattern parameters This is essentially the matcher mentioned above.

You'll probably also need to touch the index object to allow setting the skip-workingtree bit.

Cheers,

Jelmer

jelmer commented 8 years ago

On Mon, Jan 18, 2016 at 12:51:14PM +0000, Jelmer Vernooij wrote:

On Fri, Jan 15, 2016 at 01:57:27AM -0800, Owen Campbell wrote:

How about the following:

  • Add list parameters match_patterns and ignore_patterns to index.build_index_from_tree which can be used to pass unix style file pattern matches. The parameters would have a default value of None The syntax of these is the same as for gitignore files. I would suggest passing in a Matcher object which can be constructed from a .gitignore or .git/info/sparse-checkout file.
  • Create a new file path validator which uses the fnmatch module to match against the pattern parameters This is essentially the matcher mentioned above.

You'll probably also need to touch the index object to allow setting the skip-workingtree bit. See also http://schacon.github.io/git/git-read-tree.html#_sparse_checkout

meatballs commented 8 years ago

I would suggest passing in a Matcher object

What module contains that class?

jelmer commented 8 years ago

On Tue, Jan 19, 2016 at 05:15:22AM -0800, Owen Campbell wrote:

I would suggest passing in a Matcher object

What module contains that class? Such a class would have to be added. I'd rather not depend on an external package for this kind of functionality, it shouldn't be too hard to implement in Dulwich itself.

Cheers,

Jelmer

akbargumbira commented 8 years ago

Hi, just wanted to check, is sparse checkout already possible with dulwich?

jelmer commented 8 years ago

Ish. The support is there on the networking side, but there is no porcelain that can use it to set up a sparse checkout.

On 8 June 2016 13:54:24 BST, Akbar Gumbira notifications@github.com wrote:

Hi, just wanted to check, is sparse checkout already possible with dulwich?


You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/jelmer/dulwich/issues/405#issuecomment-224579678

Sent from my Android device with K-9 Mail. Please excuse my brevity.

agurtovoy commented 3 years ago

Hey @jelmer, do I understand correctly that it's technically possible to implement sparse checkout through dulwich, but it's verbose/complicated?

jelmer commented 3 years ago

@agurtovoy Pretty much. Any patches that added support to porcelain for sparse checkouts would be awesome, though you could probably also get sparse checkout support by manually calling out to some of the lower layers without modifying dulwich.